Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,870 questions

51,793 answers

573 users

How to use the function Math.min() to get the smallest of zero or more numbers in JavaScript

1 Answer

0 votes
document.write("Math.min(1, 2) = " + Math.min(1, 2) + "<br />");
document.write("Math.min(-1, -2) = " + Math.min(-1, -2) + "<br />");
document.write("Math.min(-1, 2) = " + Math.min(-1, 2) + "<br />");
document.write("Math.min(28, 982, 512) = " + Math.min(28, 982, 512) + "<br />");
document.write("Math.min(3, 2, 5, 4, 1) = " + Math.min(3, 2, 5, 4, 1) + "<br />");
document.write("Math.min() = " + Math.min() + "<br />");
document.write("Math.min(10) = " + Math.min(10) + "<br />");

 
/*
run

Math.min(1, 2) = 1
Math.min(-1, -2) = -2
Math.min(-1, 2) = -1
Math.min(28, 982, 512) = 28
Math.min(3, 2, 5, 4, 1) = 1
Math.min() = Infinity
Math.min(10) = 10
 
*/

 



answered Aug 4, 2016 by avibootz
...