> For the complete documentation index, see [llms.txt](https://lochiwei.gitbook.io/web/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lochiwei.gitbook.io/web/js/grammar/op/arithmetic/unary/+.md).

# unary plus (+)

🚧 under construction -> not not (!!)

[JS](/web/js.md) ⟩ [statement](/web/js/grammar/statement.md) ⟩ [expression](/web/js/grammar/statement/expr.md) ⟩ [operator](/web/js/grammar/op.md) ⟩ [arithmetic](/web/js/grammar/op/arithmetic.md) ⟩ [unary](/web/js/grammar/op/arithmetic/unary.md) ⟩ +

{% hint style="success" %}
[**convert**](/web/js/val/type/convert.md) any [value](/web/js/val.md) (except [Symbol](/web/js/val/prim/symbol.md), [BigInt](/web/js/val/prim/bigint.md)) to [Number](/web/js/val/prim/num.md).

```javascript
// any -> number
+x

// except Symbol, BigInt
+Symbol()   // ⛔️ TypeError
+40n        // ⛔️ TypeError
// TypeError: Cannot convert a Symbol/BigInt value to a number
```

:star2: [table of operators](/web/js/grammar/op/table-of-operators.md), [Broken mention](broken://pages/l1v0bwCArjuB3OOG3NfE)
{% endhint %}

{% tabs %}
{% tab title="🧨 雷區" %}

* [cannot convert Symbol to Number❗️](/web/js/err/type/no-sym-to-num.md)
* [cannot convert BigInt to Number❗️](/web/js/err/type/no-bigint-to-num.md)
  {% endtab %}

{% tab title="👥 相關" %}

* [type conversion](/web/js/val/type/convert.md)
* [double tilde (\~\~)](/web/js/grammar/op/arithmetic/bitwise/not/double-tilde.md) - nearest integer towards zero.
* not not (!!) - convert any -> bool.
* uses punctuator [plus (+)](/web/js/grammar/token/punctuator/+.md).
  {% endtab %}

{% tab title="📗 參考" %}

* [ ] [JavaScript: The Definitive Guide](/web/master/ref/javascript-the-definitive-guide.md) ⟩ 4.8.2 Unary Arithmetic Operators
  {% endtab %}
  {% endtabs %}
