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,884 questions

51,810 answers

573 users

How to use the function Math.log10() to get the base 10 logarithm of a number in JavaScript

1 Answer

0 votes
document.write("Math.log10(0) = " + Math.log10(0) + "<br />");
document.write("Math.log10(1) = " + Math.log10(1) + "<br />");
document.write("Math.log10(-1) = " + Math.log10(-1) + "<br />");
document.write("Math.log10(2) = " + Math.log10(2) + "<br />");
document.write("Math.log10(-2) = " + Math.log10(-2) + "<br />");
document.write("Math.log10(5) = " + Math.log10(5) + "<br />");
document.write("Math.log10(10) = " + Math.log10(10) + "<br />");
document.write("Math.log10(100) = " + Math.log10(100) + "<br />");
document.write("Math.log10(100000) = " + Math.log10(100000) + "<br />");
document.write("Math.log10(125) = " + Math.log10(125) + "<br />");
document.write("Math.log10(125)/Math.log10(5) = " + Math.log10(125)/Math.log10(5) + "<br />");

 
/*
run

Math.log10(0) = -Infinity
Math.log10(1) = 0
Math.log10(-1) = NaN
Math.log10(2) = 0.3010299956639812
Math.log10(-2) = NaN
Math.log10(5) = 0.6989700043360189
Math.log10(10) = 1
Math.log10(100) = 2
Math.log10(100000) = 5
Math.log10(125) = 2.0969100130080562
Math.log10(125) / Math.log10(5) = 2.9999999999999996
 
*/

 



answered Aug 3, 2016 by avibootz
...