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.

Example

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

Live Demo

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

Output

Property Value is : 0.6931471805599453

Updated on: 18-Jun-2020

167 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements