- Home
- /
- Tutorials
- /
- JavaScript Tutorial
- /
- JavaScript Math.min and Math.max
JavaScript Numbers & Math
JavaScript Math.min and Math.max
Math.minandMath.maxfind the smallest and largest of the values you give them.
They take separate arguments, not an array.
Spread is what bridges that gap.
Example
Example
javascript
console.log(Math.min(5, 2, 9));
console.log(Math.max(5, 2, 9));The output is 2 then 9.
