> 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/browser/api/worker/self.md).

# self

🚧 施工中

[JS](/web/js.md) ⟩ [browser](/web/browser.md) ⟩ [worker](/web/browser/api/worker.md) ⟩ global object

{% hint style="success" %}
(a [`WorkerGlobalScope`](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope) object) the [global object](/web/js/scope/global/object.md) in [web worker](/web/browser/api/worker.md) [environment](/web/js/concept/env.md).
{% endhint %}

{% tabs %}
{% tab title="⭐️ 重點" %}
{% hint style="warning" %}
in a [web worker](/web/browser/api/worker.md), the [global object](/web/js/scope/global/object.md) <mark style="color:yellow;">**reference**</mark> is made using <mark style="color:blue;">`self`</mark>:

```javascript
var name = "Joe";    // global var => global object prop
let id = 42;         // global let

self.name;           // "Joe"
self.id;             // undefined
```

{% endhint %}
{% endtab %}

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

* compare [global object](/web/js/scope/global/object.md)s in other [environment](/web/js/concept/env.md)s.
  {% endtab %}

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

* [ ] [YDKJS: Scope & Closures (v.2)](/web/master/ref/book/you-dont-know-js-series-v.2/ydkjs-scope-and-closures-v.2.md) ⟩ Ch. 4 ⟩ [Web Worker](https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/scope-closures/ch4.md#web-workers)
  {% endtab %}

{% tab title="📘 手冊" %}

* [ ] [Web APIs](https://developer.mozilla.org/en-US/docs/Web/API) ⟩&#x20;
  * [ ] [Worker](https://developer.mozilla.org/en-US/docs/Web/API/Worker)
  * [ ] [WorkerGlobalScope](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope) - the global object in web worker.
    {% endtab %}
    {% endtabs %}
