JavaScript Math.E Property



In JavaScript, we have a total of 8 mathematical constants that can be accessed as Math properties and "Math.E" is one of them.

The Math.E property in JavaScript is a static data property that represents the Euler's number.

The Euler's Number, denoted as 'e' is a numerical constant in math, it's value is approximately 2.71828. It is the base of natural logarithms.

Syntax

Following is the syntax of JavaScript Math.E property −

 Math.E 

Return value

This property returns the Euler's number.

Example 1

In the following example, we are using the JavaScript Math.E property to fetch the Euler's number −

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

Output

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

Example 2

Here, we are comparing a value "2.718281828459045" with Math.E property −

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

Output

If we execute the above program, it returns true.

Advertisements