# unary arithmetic operator

[JS](../../..) ⟩ [statement](../../statement) ⟩ [expression](../../statement/expr) ⟩ [operator](..) ⟩ [arithmetic]() ⟩ unary

{% hint style="success" %}
[unary plus (+)](unary/+), unary minus (-), increment (++), decrement (--)

:star2: [table-of-operators](../table-of-operators "mention")
{% endhint %}

{% tabs %}
{% tab title="⭐️ 重點" %}
{% hint style="success" %}
[**convert**](../../../val/type/convert) any [val](../../../val "mention") (except [symbol](../../../val/prim/symbol "mention"), [bigint](../../../val/prim/bigint "mention")) to [num](../../../val/prim/num "mention").

```javascript
// any -> number (except Symbol, BigInt)
+x

+Symbol()   // ⛔️ TypeError
+40n        // ⛔️ TypeError
// TypeError: Cannot convert a Symbol/BigInt value to a number
```
{% endhint %}
{% endtab %}

{% tab title="🧨 雷區" %}
* [no-sym-to-num](../../../err/type/no-sym-to-num "mention")
* [no-bigint-to-num](../../../err/type/no-bigint-to-num "mention")
{% endtab %}

{% tab title="🔴 主題" %}
* unary plus (+),  🚧
* unary minus (-),&#x20;
* increment (++),&#x20;
* decrement (--)
{% endtab %}

{% tab title="📗 參考" %}
* [ ] [javascript-the-definitive-guide](../../../../master/ref/javascript-the-definitive-guide "mention") ⟩ 4.8.2 Unary Arithmetic Operators
{% endtab %}
{% endtabs %}
