Math.LN2
A propriedade Math.LN2
representa o logaritmo natural (também conhecido como logaritmo neperiano) de 2, que é aproximadamente 0.693:
Property attributes of Math.LN2 |
|
---|---|
Writable | no |
Enumerable | no |
Configurable | no |
Descrição
Por LN2
ser uma propriedade estática de Math
, deve-se sempre usá-la como Math.LN2
, e não como uma propriedade de um objeto Math
que você criou.
Exemplos
Usando Math.LN2
A função a seguir retorna o logaritmo natural de 2:
js
function getNatLog2() {
return Math.LN2;
}
getNatLog2(); // 0.6931471805599453
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.LN2' in that specification. |
Padrão | |
ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'Math.LN2' in that specification. |
Padrão | |
ECMAScript (ECMA-262) The definition of 'Math.LN2' in that specification. |
Padrão em tempo real |
Compatibilidade com navegadores
BCD tables only load in the browser