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

# self

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

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

{% tabs %}
{% tab title="⭐️ 重點" %}
{% hint style="warning" %}
in a [](<> "mention"), the [object](../../../js/scope/global/object "mention") <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 [object](../../../js/scope/global/object "mention")s in other [env](../../../js/concept/env "mention")s.
{% endtab %}

{% tab title="📗 參考" %}
* [ ] [ydkjs-scope-and-closures-v.2](../../../master/ref/book/you-dont-know-js-series-v.2/ydkjs-scope-and-closures-v.2 "mention") ⟩ 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 %}
