find maximum and minimum element in an array javscript code example
Example 1: how to find max number in array javascript
const array1 = [1, 3, 2];
console.log(Math.max(...array1));
Example 2: find max and min value in array javascript
var numbers = [1, 2, 3, 4];
Math.max(...numbers) // 4
Math.min(...numbers) // 1