get max x elements from array javascript code example
Example: how to return the max and min of an array in javascript
function minMax(arr) {
return [Math.min(...arr), Math.max(...arr)];
}
function minMax(arr) {
return [Math.min(...arr), Math.max(...arr)];
}