# division (/)

[JS](../../../..) ⟩ [operator](../..) ⟩ [arithmetic](..) ⟩ division (/)

{% hint style="success" %}
:point\_right: [table-of-operators](../../table-of-operators "mention")

```javascript
a / b    // floating-point division
```
{% endhint %}

{% tabs %}
{% tab title="⭐️ 重點" %}
{% hint style="warning" %}
<mark style="color:purple;">**`/ operator`**</mark> :point\_right: [table-of-operators](../../table-of-operators "mention")

* (<mark style="color:red;">**all**</mark> [**numbers**](../../../../val/prim/num) are [<mark style="color:yellow;">**floating-point**</mark>](../../../../val/prim/num/floating-point)) \
  <mark style="color:red;">**all**</mark> <mark style="color:purple;">**division**</mark> have [<mark style="color:yellow;">**floating-point**</mark>](../../../../val/prim/num/floating-point) results. (<mark style="color:blue;">`5/2 === 2.5`</mark>)
* <mark style="color:red;">**division by zero**</mark> yields <mark style="color:red;">**±**</mark>[<mark style="color:blue;">**infinity**</mark>](../../../../val/prim/num/special/infinity) (<mark style="color:red;">**no**</mark>**&#x20;**<mark style="color:yellow;">**error**</mark>):exclamation:
* <mark style="color:red;">**0**</mark><mark style="color:purple;">**/**</mark><mark style="color:red;">**0**</mark> <mark style="color:yellow;">**evaluates**</mark> to [<mark style="color:blue;">**NaN**</mark>](../../../../val/prim/num/special/nan) (<mark style="color:red;">**no**</mark>**&#x20;**<mark style="color:yellow;">**error**</mark>):exclamation:

:bulb:neither of these cases raises an error:exclamation:
{% endhint %}
{% endtab %}

{% tab title="💈範例" %}
* replit：[division (a / b)](https://replit.com/@pegasusroe/division-ab#index.js)

```javascript
 5 / 2,    // 2.5
 3 / 0,    // Infinity
-2 / 0,    // -Infinity
 0 / 0,    // NaN
```
{% endtab %}

{% tab title="👥 相關" %}
* :small\_orange\_diamond:[prop](../../../../scope/global/object/prop "mention")：
* :no\_entry: **possible errorrs**
  *
{% endtab %}

{% tab title="📗 參考" %}
* [ ] [javascript-the-definitive-guide](../../../../../master/ref/javascript-the-definitive-guide "mention") ⟩ 4.8&#x20;
{% endtab %}

{% tab title="📘 手冊" %}
* [Infinity](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Infinity) - global property
* [NaN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN) - global property
{% endtab %}
{% endtabs %}
