--- title: Math.E slug: Web/JavaScript/Reference/Global_Objects/Math/E translation_of: Web/JavaScript/Reference/Global_Objects/Math/E ---
{{JSRef}}

La costante Math.E rappresenta la base del logaritmo naturale, e, equivale approssimativamente a 2.718.

Math.E=e2.718\mathtt{\mi{Math.E}} = e \approx 2.718

{{EmbedInteractiveExample("pages/js/math-e.html")}}
{{js_property_attributes(0, 0, 0)}}

Descrizione

Poiché E è una proprietà statica di Math, lo si usa sempre come Math.E, piuttosto che come un metodo di un Oggetto Math appositamente creato (Math non ha un costruttore).

Esempi

Uso di Math.E

Il codice seguente restitusice e:

function getNapier() {
  return Math.E;
}

getNapier(); // 2.718281828459045

Specifiche

Specification Status Comment
{{SpecName('ES1')}} {{Spec2('ES1')}} Initial definition. Implemented in JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.8.1.1', 'Math.E')}} {{Spec2('ES5.1')}}  
{{SpecName('ES6', '#sec-math.e', 'Math.E')}} {{Spec2('ES6')}}  
{{SpecName('ESDraft', '#sec-math.e', 'Math.E')}} {{Spec2('ESDraft')}}  

Compatibilità Browser

{{Compat("javascript.builtins.Math.E")}}

Vedi anche