> For the complete documentation index, see [llms.txt](https://jen-hsuan-hsieh.gitbook.io/javascript-node-js/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jen-hsuan-hsieh.gitbook.io/javascript-node-js/chapter1/12javascript-quan-gong-lve-ff1a-ke-fu-js-de-qi-guai-bu-fen/121zhi-xing-huan-jing-yu-ci-hui-huan-jing/1216han-shu-hu-jiao-yu-zhi-xing-dui.md).

# 1.2.1.6.函數呼叫與執行堆

* 函數呼叫 (Invocation, invoke the function)
  * 執行堆一開始會有全域執行環境 (global Execution context)
  * 每當有新的**函數呼叫**就會創造一個新的執行環境 (Execution context)然後放到執行堆中
    * 宣告的順序不會影響執行堆中的順序
  * 以下面例子來說

    ```
    function b() {
    }

    function a() {
      b();
    }

    a();
    ```

    * 將會建立對應的執行堆為 ![](https://3195929128-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M4M0G8GO2MkGtHfarAf%2F-M4M0IHoyFvfGKjf7P-T%2F-M4M0NUGgkoUmZU7L5mY%2F23425.jpg?generation=1586302921479781\&alt=media)
    * 在執行堆中最上層的Execution context會被最先執行
    * 執行完的Execution context會從執行堆中被pop掉
