Math.SQRT2
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
TheMath.SQRT2 static data property represents the square root of 2, approximately 1.414.
In this article
Try it
function getRoot2() { return Math.SQRT2;}console.log(getRoot2());// Expected output: 1.4142135623730951Value
Property attributes ofMath.SQRT2 | |
|---|---|
| Writable | no |
| Enumerable | no |
| Configurable | no |
Description
Math.SQRT2 is a constant and a more performant equivalent toMath.sqrt(2).
BecauseSQRT2 is a static property ofMath, you always use it asMath.SQRT2, rather than as a property of aMath object you created (Math is not a constructor).
Examples
>Using Math.SQRT2
The following function returns the square root of 2:
js
function getRoot2() { return Math.SQRT2;}getRoot2(); // 1.4142135623730951Specifications
| Specification |
|---|
| ECMAScript® 2026 Language Specification> # sec-math.sqrt2> |