JavaScript Math.LOG2E Property
- Syntax of JavaScript
Math.LOG2E: - Example Code: Use the
Math.LOG2EProperty to Get the Logarithm ofeGiven Base 2 - Example Code: Use the
Math.LOG2E()Property With Different Arithmetic Operators
We can use the Math.LOG2E property to find the logarithm of e when the given base is 2. Here, e represents the Euler’s number, and its value is approximately 2.72.
Syntax of JavaScript Math.LOG2E:
Math.LOG2E; Parameters
The Math.LOG2E property doesn’t take any parameters.
Return
The Math.LOG2E method returns the base 2 logarithm of e, approximately 1.442.
Example Code: Use the Math.LOG2E Property to Get the Logarithm of e Given Base 2
In the example below, we have used the Math.LOG2E property of the JavaScript Math library to get the logarithm of e, given base 2. You can see in the output that it always returns a constant value of approximately 1.442.
let logEBase2 = Math.LOG2E; console.log(logEBase2); Output:
1.4426950408889634 Example Code: Use the Math.LOG2E() Property With Different Arithmetic Operators
In this example, we used the Math.LOG2E property and its value with different arithmetic operators. In such a way, users can use the value of the logarithm of e, given base 2, to perform different operations.
let logEBase2 = Math.LOG2E; let value1 = logEBase2 + 10; let value2 = 20 - Math.LOG2E; console.log(value1); console.log(value2); console.log(Math.LOG2E*2); Output:
11.442695040888964 18.557304959111036 2.8853900817779268 We have learned to use the Math.LOG2E property of JavaScript in the different use cases in this article.
