1.2.1.6.函數呼叫與執行堆
Last updated
Was this helpful?
Last updated
Was this helpful?
函數呼叫 (Invocation, invoke the function)
執行堆一開始會有全域執行環境 (global Execution context)
每當有新的函數呼叫就會創造一個新的執行環境 (Execution context)然後放到執行堆中
宣告的順序不會影響執行堆中的順序
以下面例子來說
將會建立對應的執行堆為
在執行堆中最上層的Execution context會被最先執行
執行完的Execution context會從執行堆中被pop掉