Math.SQRT2
Resum
La propietat Math.SQRT2
representa la rel quadrada de 2, que és aproximadament 1.414:
Property attributes of Math.SQRT2 |
|
---|---|
Writable | no |
Enumerable | no |
Configurable | no |
Descripció
Degut a que SQRT2
és una propietat estàtica de Math
, sempre s'utilitza com a Math.SQRT2
, en comptes de com la propietat d'una instància de Math
(Math
no és un constructor).
Exemples
Exemple: Utilitzar Math.SQRT2
La funció següent retorna la rel quadrada de 2:
function getRoot2() {
return Math.SQRT2;
}
getRoot2(); // 1.4142135623730951
Especificacions
Especificació | Estat | Comentaris |
---|---|---|
ECMAScript 1a Edició. | Standard | Definició inicial. Implementat a JavaScript 1.0. |
ECMAScript 5.1 (ECMA-262) The definition of 'Math.SQRT2' in that specification. |
Standard | |
ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'Math.SQRT2' in that specification. |
Standard |
Compatibilitat amb navegadors
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help! (en-US)
Característica | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Suport bàsic | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |
Característica | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Suport bàsic | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |