JavaScript Math LOG2E Property
Last Updated :
10 Jan, 2023
The Javascript Math.LOG2E is a property in JavaScript that is simply used to find the value of base 2 logarithms of e, where e is an irrational and transcendental number approximately equal to 1.442.
Syntax:
Math.LOG2E;
Return Values: It simply returns the value of the base 2 logarithms of e.
Example: Here simple value of base 2 logarithms of e is shown as output.
Input : Math.LOG2E
Output:1.4426950408889634
Example: The below example illustrates the Math LOG2E property in JavaScript.
javascript
<script>
console.log(Math.LOG2E);
</script>
|
Output:
1.4426950408889634
Example: The value of the base 2 logarithms of e can be printed in the form of a function as shown below.
javascript
<script>
function get_Value_of_base_2_lagarithm_of_e()
{
return Math.LOG2E;
}
console.log(get_Value_of_base_2_lagarithm_of_e());
</script>
|
Output:
1.4426950408889634
Example: Here we consider Math.LOG2E is a function but in actuality, it is a property which is why the error as output is being shown.
javascript
<script>
console.log(Math.LOG2E(12));
</script>
|
Output:
Error: Math.LOG2E is not a function
Example: Whenever we need to find the value of the base 2 logarithms of e that time we take the help of this property. In mathematics, it needed a lot.
javascript
<script>
console.log(Math.LOG2E);
</script>
|
Output:
1.4426950408889634
We have a complete list of Javascript Math Objects methods, to check those please go through this Javascript Math Object Complete reference article.
Supported Browsers:
- Google Chrome 1 and above
- Internet Explorer 3 and above
- Edge 12 and above
- Firefox 1 and above
- Opera 3 and above
- Safari 1 and above
Share your thoughts in the comments
Please Login to comment...