js select number highest code example
Example 1: js max value of array
let numbers = [4, 13, 27, 0, -5]; // Get max value of an array in Javascript
Math.max.apply(null, numbers); // returns 27
Example 2: largest and smallest number in an array 1-100 javascript
let numArray = [95, 1, 75, 7, 12, 50, 3, 88]
numArray.slice().sort(function(a, b) {
return a - b
})
console.log('smallest: ' + numArray[0] + ', largest: ' + numArray[numArray.length - 1])