JavaScript Tutorial JavaScript References

JavaScript - Math.SQRT2 Property



The JavaScript Math.SQRT2 property is the Square root of 2. It is approximately 1.414.

Syntax

Math.SQRT2

Example:

The example below shows the usage of Math.SQRT2 property.

var txt;

txt = "Math.SQRT2 = " + Math.SQRT2 + "<br>";
txt = txt + "Math.SQRT2**2 = " + Math.SQRT2**2 + "<br>";
txt = txt + "Math.SQRT1_2*Math.SQRT2 = " + Math.SQRT1_2*Math.SQRT2 + "<br>";

The output (value of txt) after running above script will be:

Math.SQRT2 = 1.4142135623730951
Math.SQRT2**2 = 2.0000000000000004
Math.SQRT1_2*Math.SQRT2 = 1.0000000000000002

❮ JavaScript - Math Object

5