8 lines
232 B
JavaScript
8 lines
232 B
JavaScript
function max(input) {
|
|
if (toString.call(input) !== "[object Array]")
|
|
return false;
|
|
return Math.max.apply(null, input);
|
|
}
|
|
|
|
console.log(max([12,34,56,1]));
|
|
console.log(max([-12,-34,0,-56,-1])); |