JavaScript Math.LOG10E Property



In JavaScript, the Math.LOG2E property represents the base 2 logarithm of Euler's number, denoted as "e". Euler's number, represented by the mathematical constant "e" approximately equals 2.71828.

The LOG2E property's value is a numeric constant, approximately equal to 1.4426. This value is derived from the mathematical relationship between the natural logarithm of "e" (denoted as "ln(e)") and the base 2 logarithm of "e".

Mathematically, the relationship between the base 2 logarithm of "e" and "ln(e)" can be expressed as shown below −

log2(e) = ln(e) / ln(2)

So, Math.LOG2E is the value of ln(e) divided by the value of ln(2).

Syntax

Following is the syntax of JavaScript Math.LOG10E property −

Math.LOG10E

Return value

This property returns the base-10 logarithm of E.

Example 1

In the following example, we are using the JavaScript Math.LOG10E property to retrieve the base-10 logarithm of E −

<html>
<body>
<script>
   let result = Math.LOG10E;
   document.write(result);
</script>
</body>
</html>

Output

If we execute the above program, it returns a value approximately 0.4342.

Example 2

Here, we are comparing the value "0.4342944819032518" with Math.LOG10E property −

<html>
<body>
<script>
   let result = Math.LOG10E;
   document.write(result === 0.4342944819032518);
</script>
</body>
</html>

Output

It returns true because, this property represents the value 0.4342 (which is the base-10 logarithm of E).