Math.min()



Q: What does Math.min() do?


When you use this method it will give you the smallest value among a group of numbers.


Q: How do I use it?


NOTE: This method needs you to specify numbers for the multiple compaired values. If at least one of the arguements cannot be converted to a number then NaN is given. If there are no arguements given, this results in -Infinity.


Syntax:


			

//make sure to put in numerical values seperated with commas

 Math.min(x, y, x, ..., ...);

			
		

Example:



Script:


					

function minexample() {
    document.getElementById("min").innerHTML = Math.min(1, 3, 5, 7, 9);
}
				
					


Go to page

Back to main page