Math.min() in javascript

     The Math.min() function returns the smallest of zero or more numbers. min() is a static method of Math, you always use it as Math.min(), 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.min([value1,value2,...]);
Example

   Math.min(20,50,36,2);  //2
   Math.min(-3,3,0,99);  //-3


Example Program:- (Editor)


Editor is Loading...

Advertisement

Related Posts:

  • Math.floor() in javascript     The Math.floor() function returns the largest integer less than or equal to a given number. floor() is a static method of Mat… Read More
  • Math.random() in javascript     The Math.random() function returns a floating-point, pseudo-random number in the range [0, 1] that is, from 0 (inclusive) up to bu… Read More
  • Math.round() in javascript     The Math.round() function returns the value of a number rounded to the nearest integer. If the fractional portion of number is 0.5… Read More
  • 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.m… Read More
  • Math.ceil() in javascript     The Math.ceil() function returns the smallest integer greater than or equal to a given number. ceil() is a static method of M… Read More

0 nhận xét:

Đăng nhận xét