In this tutorial we will learn about two built-in utilities of JavaScript — the Math module and the Date module.

# Math

The Math module has functions to do various mathematical operations, and it also includes functions for generating random numbers. It has many constant values as well, like the value of pi (ratio of a circle's circumference to its diameter), etc.

# Math Constants

Let's start by looking at some of the constants defined in the Math object. We will use the JavaScript Console for this tutorial to run the examples interactively.

Math.E is the Euler's constant — e. It is used as the base of natural logarithm, and its value is approximately 2.718.

> Math.E< 2.718281828459045

Math.PI is the ratio of a circle's circumference to its diameter. It's value is approximately equal to 3.14.

> Math.PI< 3.141592653589793

Similarly, there are some other constants available:

- Square root of 1/2, or \sqrt{1/2} .

> Math.SQRT1_2< 0.7071067811865476

- Square root of 2, or \sqrt{2}.

> Math.SQRT2< 1.4142135623730951

- Logarithm of Math.E to the base 2, or \log_2e.

> Math.LOG2E< 1.4426950408889634

- Logarithm of Math.E to the base 10, or \log_{10}{e}.

> Math.LOG10E< 0.4342944819032518