ES6 - Math max() Function
This method returns the largest of zero or more numbers. If no arguments are given, the results is Infinity.
Syntax
Math.max(x1,x2,x3..)
Parameter
- X1,x2,x3.. − represents a series of numbers
Example
console.log("---Math.max()---")
console.log("Math.max(3, 0.5, 0.66) : "+Math.max(3, 0.5, 0.66))
console.log("Math.max(-3, 0.5, -0.66) : "+Math.max(-3, 0.5, -0.66))
Output
---Math.max()--- Math.max(3, 0.5, 0.66) : 3 Math.max(-3, 0.5, -0.66) : 0.5
Advertisements