函数上下文的变量对象实例

学习文章 -----汤姆大叔的博客

总结笔记

1. 只有在函数被调用的时候,才会进入函数的执行上下文环境。

2. 执行上下文代码分为两个阶段:①进入执行上下文。②执行代码。

 

实例:

function test(a, b) {
  var c = 10;
  function d() {}
  var e = function _e() {};
  (function x() {});
}
 
test(10); // call

第一个阶段:进入执行上下文。

AO(test) = {
  a: 10,
  b: undefined,
  c: undefined,
  d: <reference to FunctionDeclaration "d">
  e: undefined
};

第二个阶段:执行代码。

AO['c'] = 10;
AO['e'] = <reference to FunctionExpression "_e">;

  

posted @ 2016-11-22 20:09  FatDong  阅读(191)  评论(0编辑  收藏  举报