# top-level scope

[JS](..) ⟩ [concepts](../../browser/concepts) ⟩ [scope]() ⟩ top-level

{% hint style="success" %}
<mark style="color:purple;">**top-level scope**</mark> relative to a <mark style="color:yellow;">**JS**</mark> file.

* in <mark style="color:yellow;">**Node.js**</mark>：[module](module "mention") ( top-level [this](../concept/execution-context/this "mention") === <mark style="color:blue;">`module.exports`</mark>)
* in <mark style="color:yellow;">**browser**</mark>：
  * script mode： [global](global "mention"). &#x20;
  * module mode： [module](module "mention")
{% endhint %}

{% tabs %}
{% tab title="⭐️ 重點" %}
{% hint style="info" %}
[variable](global/variable "mention")s <mark style="color:red;">**don't**</mark>**&#x20;**<mark style="color:yellow;">**get created**</mark> by [declaring variables](../variable/declare) in the <mark style="color:purple;">**top-level scope**</mark> of a [module](../module "mention") ([module](module "mention")).
{% endhint %}
{% endtab %}

{% tab title="🗣 討論" %}
* [What is the 'global' object in NodeJS](https://stackoverflow.com/a/52193294/5409815)
* [Meaning of "this" in node.js modules and functions](https://stackoverflow.com/questions/22770299/meaning-of-this-in-node-js-modules-and-functions/22771432#22771432)
{% endtab %}

{% tab title="📘 手冊" %}
* [ ] Node.js ⟩ ["global"](https://nodejs.org/api/globals.html#globals_global) ⭐️
{% endtab %}
{% endtabs %}
