# \[\[Environment]]

[JS](/web/js.md) ⟩ [concepts](/web/browser/concepts.md) ⟩ [scope](/web/js/scope.md) ⟩ [lexical environment](/web/js/concept/execution-context/lexical-environment.md) ⟩ <mark style="color:purple;">`[[Environment]]`</mark>

{% hint style="success" %}
All [function](/web/js/val/func.md)s <mark style="color:orange;">**remember**</mark> the [lexical environment](/web/js/concept/execution-context/lexical-environment.md) <mark style="color:yellow;">**in which they were made**</mark>.&#x20;

* every <mark style="color:yellow;">**function**</mark> has the <mark style="color:yellow;">**hidden**</mark> [internal property](/web/js/val/obj/prop/internal.md) named <mark style="color:purple;">`[[Environment]]`</mark>, that <mark style="color:yellow;">**keeps**</mark> the <mark style="color:yellow;">**reference**</mark> to the <mark style="color:yellow;">**Lexical Environment**</mark> where the function was created.

📗 JS.info ⟩ [Lexical Environment](https://javascript.info/closure#step-4-returning-a-function)
{% endhint %}

{% tabs %}
{% tab title="🖥️ 影片" %}
{% embed url="<https://youtu.be/HuF-qYRnEAo>" %}
{% endtab %}

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

* [internal property](/web/js/val/obj/prop/internal.md)
  {% endtab %}

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

* [ ] JS.info ⟩ [Lexical Environment](https://javascript.info/closure#lexical-environment) ⭐️
  {% endtab %}
  {% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://lochiwei.gitbook.io/web/js/concept/execution-context/lexical-environment/environment.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
