JavaScript Math.LN2 Property



JavaScript provides 8 mathematical constants that can be accessed as Math properties and "Math.LN2" property is one of them.

The JavaScript Math.LN2 property is used to represent the natural logarithm of 2, that is approximately 0.6931. This property is equivalent to Math.log(2).

Syntax

Following is the syntax of JavaScript Math.LN2 property −

Math.LN2

Return value

This property returns a number that represents the natural logarithm of 2.

Example 1

In the following example, we are using the JavaScript Math.LN2 property to retrieve the natural logarithm of 2 −






Output

After executing the above program, we get a value approximately 0.6931.

Example 2

The Math.LN10 property is equivalent to Math.log(2) −






Output

If we execute the above program, the Math.log(2) will return the same result as Math.LN2.

Advertisements