---
description: 🚧 under construction
---

# environment record

[JS](../../..) ⟩ [concepts](../../../../browser/concepts) ⟩ [scope](../../../scope) ⟩ [lexical environment]() ⟩ environment record

{% hint style="success" %}
an [obj](../../../val/obj "mention") that is <mark style="color:yellow;">**part**</mark> of a "[](<> "mention")", it stores：

* all <mark style="color:yellow;">**local**</mark> [variable](../../../variable "mention")(s) as its [<mark style="color:orange;">**properties**</mark>](../../../val/obj/prop).
* <mark style="color:yellow;">**other information**</mark> like the value of [this](../this "mention").&#x20;

📗 JS.info ⟩ [Lexical Environment](https://javascript.info/closure#lexical-environment)
{% endhint %}

{% tabs %}
{% tab title="🗺️ 圖解" %}
* Lexical Environments (linked together)

<img src="https://2527454625-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfvEFZnSBhKT6fJmus0%2Fuploads%2FRiPk2hPzkYjgnTvI3diN%2Flexical.environment.svg?alt=media&#x26;token=4aa199a3-a217-4f06-9941-bd01be4e0e92" alt="Lexical Environment(s)" class="gitbook-drawing">



* Environment Record Hierarchy (object graph)

<img src="https://2527454625-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfvEFZnSBhKT6fJmus0%2Fuploads%2FI1lI7FGRbBSwUUx9Gzjn%2Fenvironment.record.hierarchy.svg?alt=media&#x26;token=a03e56b0-c96f-473b-9c1e-a64cca40bd62" alt="Environment Record Hierarchy" class="gitbook-drawing">
{% endtab %}

{% tab title="⭐️ 重點" %}
{% hint style="info" %}
A "[variable](../../../variable "mention")" is just a [prop](../../../val/obj/prop "mention") of the [environment-record](environment-record "mention") (associated with the <mark style="color:yellow;">**currently executing**</mark> [block](../../../grammar/statement/other/block "mention") /[func](../../../val/func "mention") /[module](../../../module "mention") /<mark style="color:yellow;">**script**</mark>).&#x20;
{% endhint %}
{% endtab %}

{% tab title="👥 相關" %}
* :exclamation:[this-determined-on-call-site](../this/this-determined-on-call-site "mention")
{% 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. 1
* [ ] JS.info ⟩ [Lexical Environment](https://javascript.info/closure#lexical-environment)
{% endtab %}

{% tab title="📘 手冊" %}
* [js-spec](../../../../master/ref/js-spec "mention") ⟩ [The Environment Record Type Hierarchy](https://tc39.es/ecma262/#sec-the-environment-record-type-hierarchy) ⭐️
{% endtab %}
{% endtabs %}
