Use Math.max and Math.min along with spread operator to find extremes in an array.
Source Code
let numbers = [10, 5, 100, 2, 1000];
console.log(Math.max(...numbers)); // 1000
console.log(Math.min(...numbers)); // 2
Use Math.max and Math.min along with spread operator to find extremes in an array.
let numbers = [10, 5, 100, 2, 1000];
console.log(Math.max(...numbers)); // 1000
console.log(Math.min(...numbers)); // 2