Compute Max
Examples in
JavaScript
console.log(Math.max(1, 3, 2));
// expected output: 3
console.log(Math.max(-1, -3, -2));
// expected output: -1
var array1 = [1, 3, 2];
console.log(Math.max(...array1));
// expected output: 3
Math.max(10, 20); // 20
Math.max(-10, -20); // -10
Math.max(-10, 20); // 20