---
description: 🚧 施工中
---

# function scope

[JS](..)⟩ [scope]() ⟩ function scope

{% hint style="success" %}
[](<> "mention") created with a [func](../val/func "mention").
{% endhint %}

{% tabs %}
{% tab title="👥 相關" %}
* compare： [block](../grammar/statement/other/block/block "mention")
{% endtab %}

{% tab title="⭐️ 重點" %}
{% hint style="warning" %}
[in-block-cant-shadow](../variable/declare/var/in-block-cant-shadow "mention"):exclamation: - [var](../variable/declare/var "mention") only has <mark style="color:purple;">**function scope**</mark>.
{% endhint %}

{% hint style="info" %}
... each <mark style="color:yellow;">**function**</mark> gets its <mark style="color:yellow;">**own scope**</mark>, sometimes called the "<mark style="color:purple;">**activation object**</mark>". 👉  [RingoJS](https://ringojs.org/documentation/module_and_global_scope/)
{% endhint %}

{% hint style="warning" %}
<mark style="color:red;">**not**</mark>  [block](../grammar/statement/other/block "mention")：

* [obj](../val/obj/create/obj "mention") / [class](../val/class "mention") / [switch](../grammar/statement/flow/branch/switch "mention") ( <mark style="color:red;">**no**</mark> [block](../grammar/statement/other/block/block "mention"):exclamation:)
* [func](../val/func "mention")'s [scope](function) is <mark style="color:yellow;">**different**</mark> from a [block](../grammar/statement/other/block/block "mention"):exclamation:

📗 [You Don't Know JS Yet: Scopes & Closrues](https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/scope-closures/ch6.md#scoping-with-blocks)
{% endhint %}
{% endtab %}

{% tab title="📗 參考" %}
* [ ] ringojs ⟩ [Understanding module and global scope](https://ringojs.org/documentation/module_and_global_scope/) ⭐️
{% endtab %}

{% tab title="📘 手冊" %}
* [ ] [Scope](https://developer.mozilla.org/en-US/docs/Glossary/Scope)
* [ ] [Function](https://developer.mozilla.org/en-US/docs/Glossary/Function)
{% endtab %}
{% endtabs %}
