programming-examples/js/Math/Find the lowest value in an array.js

8 lines
233 B
JavaScript
Raw Normal View History

2019-11-15 12:59:38 +01:00
function min(input) {
if (toString.call(input) !== "[object Array]")
return false;
return Math.min.apply(null, input);
}
console.log(min([12,34,56,1]));
console.log(min([-12,-34,0,-56,-1]));