How to use Math LN2 Property in JavaScript

In this article, I will explain use of Math LN2 Property in JavaScript.
  • 1551

JavaScript Math LN2 Property

  • LN2 property returns the natural logarithm of 2 which is approximately 0.693.

Syntax

Math.LN2

Example

The following example shows how to use Math LN2 Property in javascript.

<!DOCTYPE html>

<html>

<body>

<h2>This is the Math LN2 property example</h2>

<p id="demo">Click the button to get the natural logarithm of 2.</p>

<button onclick="myFunction()">Click on</button>

<script type="text/javascript">

    function myFunction() {

        document.getElementById("demo").innerHTML = Math.LN2;

    }

</script>

</body>

</html>

 

Output 1

 

LN2 output 1.jpg

 

Output 2


LN2 Final output.jpg

Further Readings

You may also want to read these related articles here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2018 DotNetHeaven. All rights reserved.