How to get Natural logarithm of 2 in JavaScript?

To get the Natural logarithm of 2, use the Math.LN2 property in JavaScript. It returns the natural logarithm of 2, which is approximately 0.693.


You can try to run the following code to get Natural logarithm of 2 −

Live Demo

      <title>JavaScript Math LN2 Property</title>
         var property_value = Math.LN2
         document.write("Property Value is : " + property_value);


Property Value is : 0.6931471805599453