💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
### 执行上下文 1. 执行上下文:一般来说执行上下文代表执行环境 2. 每次函数被调用创建新的执行上下文,包括调用他本身 **调用函数之后,函数内部执行的顺序** 1. 创建阶段 2. 执行阶段 **创建阶段** 1. 初始化作用域链 2. 创建变量,函数,和参数 3. 求this的值 ~~~ function foo(i) { var a = 'hello'; var b = function privateB() { }; function c() { } } foo(22); ~~~ 当调用foo(22)时,创建状态像下面这样: ~~~ fooExecutionContext= { scopeChain={.....}, variableObject: { arguments:{ 0 : 22, length: 1 }, i: 22, a: undefind, b:undefind, c:pointer to function c() }, this: {....} } ~~~