how to find the max in array js code example
Example 1: Find the maximum number of an array js
function getMaxOfArray(numArray) {
return Math.max.apply(null, numArray);
}
Example 2: how to return the max and min of an array in javascript
function minMax(arr) {
return [Math.min(...arr), Math.max(...arr)];
}