Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

define math.min() method in javascript

// Math.mix()

// The Math.min() method is used to return the smallest of zero or more numbers. 
// The result is “-Infinity” if no arguments are passed and the result is NaN if at least one of the arguments cannot be converted to a number.
// The min() is a static method of Math, therefore, it is always used as Math.min(), rather than as a method of a Math object created.

// EXAMPLE : 1
let num = Math.min(5,8,100,50);
console.log(num);
// OUTPUT: 5

// EXAMPLE : 2
let num_2 = Math.min(-5,-8,-100,-50);
console.log(num_2);
// OUTPUT: -100

// EXAMPLE : 3
let num_3 = Math.min();
console.log(num_3);
// OUTPUT: Infinity

// EXAMPLE : 4
let num_4 = Math.min("Haseeb",3,70);
console.log(num_4);
// OUTPUT: NaN (NOT A NUMBER)
 
PREVIOUS NEXT
Tagged: #define #method #javascript
ADD COMMENT
Topic
Name
6+7 =