Math.max() in javascript

     The Math.max() function returns the largest of zero or more numbers. max() is a static method of Math, you always use it as Math.max(), rather than as a method of a Math object you created (Math is not a constructor).

     If no arguments are given, the result is -Infinity.
     If at least one of arguments cannot be converted to a number, the result is NaN.

Syntax

     Math.max([value1,value2,value3,...]);
Example

Math.max(50, 10);   //  50



Math.max(-1, -200); // -1



Math.max(-999, 2);  //  2


Example Program:- (Editor)


Editor is Loading...

Advertisement

0 nhận xét:

Đăng nhận xét