More Math Functions
Math has round, floor, ceil, trunc, abs, min, max, pow, sqrt, sign, hypot and trig functions. Spread an array into Math.max.
Example
console.log(Math.round(2.5), Math.floor(-2.5), Math.ceil(2.1), Math.trunc(-2.9));
console.log(Math.max(...[3, 9, 4]), Math.min(1, 2), Math.hypot(3, 4), Math.sign(-8));Exercise
Largest value.
Math.(1, 5)
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.