> 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/val/prim/boolean.md).

# Boolean

[JS](/web/js.md) ⟩ [primitive](/web/js/val/prim.md) ⟩ boolean

{% hint style="success" %}

```javascript
!!x    // any -> boolean
```

{% endhint %}

{% tabs %}
{% tab title="⭐️ 重點" %}
{% hint style="info" %} <mark style="color:yellow;">**Every**</mark> [value](/web/js/val.md) <mark style="color:yellow;">**is either**</mark> [<mark style="color:green;">**truthy**</mark>](/web/js/val/type/falsy.md) <mark style="color:yellow;">**or**</mark> [<mark style="color:purple;">**falsy**</mark>](/web/js/val/type/falsy.md):exclamation:
{% endhint %}

{% hint style="warning" %}
&#x20;[operator](/web/js/grammar/op.md)(s) that expect [<mark style="color:yellow;">**boolean**</mark>](/web/js/val/prim/boolean.md) operands will work with an operand of <mark style="color:red;">**any**</mark>**&#x20;**<mark style="color:yellow;">**type**</mark>:exclamation:
{% endhint %}

{% hint style="success" %}
[**convert**](/web/js/val/type/convert.md) any [value](/web/js/val.md) to <mark style="color:purple;">**Boolean**</mark>.

```javascript
!!x    // conversion: any -> true/false
```

{% endhint %}
{% endtab %}

{% tab title="🔴 主題" %}

* [falsy](/web/js/val/type/falsy.md)
  {% endtab %}

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

* [not(f)](/web/js/val/func/kind/higher/not-f.md) - logical negation of a function.
  {% endtab %}
  {% endtabs %}
