Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. JavaScript
  3. Reference
  4. Standard built-in objects
  5. Math
  6. SQRT2

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.

Try it

function getRoot2() {  return Math.SQRT2;}console.log(getRoot2());// Expected output: 1.4142135623730951

Value

𝙼𝚊𝚝𝚑.𝚂𝚀𝚁𝚃𝟸=21.414\mathtt{Math.SQRT2} = \sqrt{2} \approx 1.414
Property attributes ofMath.SQRT2
Writableno
Enumerableno
Configurableno

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.4142135623730951

Specifications

Specification
ECMAScript® 2026 Language Specification
# sec-math.sqrt2

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp