Skip to content

Commit

Permalink
[zh-TW]: create LOG2E (#25021)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr-XYZ authored Dec 18, 2024
1 parent 978271d commit 22a497c
Showing 1 changed file with 52 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
title: Math.LOG2E
slug: Web/JavaScript/Reference/Global_Objects/Math/LOG2E
l10n:
sourceCommit: 2ec170b6264d51a15be498ac99b8a30b3dadec15
---

{{JSRef}}

**`Math.LOG2E`** 靜態數據屬性表示 [e](/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Math/E) 以 2 為底的對數值,約為 1.443。

{{EmbedInteractiveExample("pages/js/math-log2e.html", "shorter")}}

##

<math display="block">
<semantics><mrow><mi>𝙼𝚊𝚝𝚑.𝙻𝙾𝙶𝟸𝙴</mi><mo>=</mo><msub><mo lspace="0em" rspace="0em">log</mo><mn>2</mn></msub><mo stretchy="false">(</mo><mi mathvariant="normal">e</mi><mo stretchy="false">)</mo><mo>≈</mo><mn>1.443</mn></mrow><annotation encoding="TeX">\mathtt{Math.LOG2E} = \log_2(\mathrm{e}) \approx 1.443</annotation></semantics>
</math>

{{js_property_attributes(0, 0, 0)}}

## 描述

由於 `LOG2E``Math` 的靜態屬性,因此你應始終以 `Math.LOG2E` 的方式使用,而非作為某個 `Math` 物件的屬性(`Math` 並不是建構子)。

## 範例

### 使用 Math.LOG2E

以下函式返回 e 以 2 為底的對數值:

```js
function getLog2e() {
return Math.LOG2E;
}

getLog2e(); // 1.4426950408889634
```

## 規範

{{Specifications}}

## 瀏覽器相容性

{{Compat}}

## 參見

- {{jsxref("Math.exp()")}}
- {{jsxref("Math.log()")}}
- {{jsxref("Math.log2()")}}

0 comments on commit 22a497c

Please sign in to comment.