Math.SQRT2
A propriedade Math.SQRT2
representa a raiz quadrada de 2, que é aproximadamente 1.414:
Property attributes of Math.SQRT2 |
|
---|---|
Writable | no |
Enumerable | no |
Configurable | no |
Descrição
Por SQRT2
ser uma propriedade estática de Math
, deve-se sempre usá-la como Math.SQRT2
, e não como propriedade de um objeto Math
criado por você (Math
não é um construtor).
Examples
Usando Math.SQRT2
A função a seguir retorna a raiz quadrada de 2:
js
function getRoot2() {
return Math.SQRT2;
}
getRoot2(); // 1.4142135623730951
Especificações
Specification | Status | Comment |
---|---|---|
ECMAScript 1st Edition (ECMA-262) | Padrão | Initial definition. Implemented in JavaScript 1.0. |
ECMAScript 5.1 (ECMA-262) The definition of 'Math.SQRT2' in that specification. |
Padrão | |
ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'Math.SQRT2' in that specification. |
Padrão | |
ECMAScript (ECMA-262) The definition of 'Math.SQRT2' in that specification. |
Padrão em tempo real |
Compatibilidade com navegadores
BCD tables only load in the browser