FunctionExectionContext = { LexicalEnvironment: { EnvironmentRecord: { type: 'Declarative', arguments: { 0: 20, 1: 30, length: 2 } }, outer: <GlobalLexicalEnvironment> }, VariableEnvironment: { EnvironmentRecord: { Type: "Declarative", g: undefined }, outer: <GlobalLexicalEnvironment>, }, thisBinding: <Global Object or undefined> }
之后执行上下文会进入执行阶段, 此时的函数上下文:
FunctionExectionContext = { LexicalEnvironment: { EnvironmentRecord: { type: 'Declarative', arguments: { 0: 20, 1: 30, length: 2 } }, outer: <GlobalLexicalEnvironment> }, VariableEnvironment: { EnvironmentRecord: { Type: "Declarative", g: 20 }, outer: <GlobalLexicalEnvironment>, }, thisBinding: <Global Object or undefined> }
当函数执行完毕后。会返回一个值并赋值给变量c,全局上下文被更新。更新完成后,代码执行完毕,程序结束。