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

51,886 answers

573 users

How to use the function Math.log() to get the natural logarithm (base e) of a numbers in JavaScript

1 Answer

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

 
/*
run

Math.log(0) = -Infinity
Math.log(1) = 0
Math.log(-1) = NaN
Math.log(5) = 1.6094379124341002
Math.log(10) = 2.302585092994046
Math.log(100) = 4.605170185988092
Math.log(125) = 4.8283137373023015
Math.log(125) / Math.log(5) = 3.0000000000000004
 
*/

 



answered Aug 3, 2016 by avibootz
...