Math.E
Baseline
Widely available
This feature is well established and works across many devices and browser versions. Itâs been available across browsers since 2015å¹´7æ.
Math.E éæ
è³æå±¬æ§ä»£è¡¨æææ¸ï¼Euler's numberï¼ï¼å³èªç¶å°æ¸çåºæ¸ e ï¼å
¶å¼ç´çº 2.718ã
å試ä¸ä¸
function compoundOneYear(interestRate, currentVal) {
return currentVal * Math.E ** interestRate;
}
console.log(Math.E);
// é æè¼¸åºï¼2.718281828459045
console.log((1 + 1 / 1000000) ** 1000000);
// é æè¼¸åºï¼2.718280469 (approximately)
console.log(compoundOneYear(0.05, 100));
// é æè¼¸åºï¼105.12710963760242
å¼
Math.E ç屬æ§ç¹æ§ | |
|---|---|
| å¯å¯« | å¦ |
| å¯åè | å¦ |
| å¯é ç½® | å¦ |
æè¿°
ç±æ¼ E æ¯ Math çéæ
屬æ§ï¼å æ¤ä½ å¿
é ä½¿ç¨ Math.Eï¼è䏿¯å¾ä½ æå»ºç«ç Math ç©ä»¶ä¸åå該屬æ§ï¼Math 並é建æ§åï¼ã
ç¯ä¾
>ä½¿ç¨ Math.E
以ä¸å½å¼æåå³ eï¼
js
function getNapier() {
return Math.E;
}
getNapier(); // 2.718281828459045
è¦ç¯
| Specification |
|---|
| ECMAScript® 2027 Language Specification > # sec-math.e > |