A variable object is a container of data associated with the execution context. It’s a special object that stores variables and function declarations defined in the context.
var foo=10;
function func(){};
//因为是在全局作用域当中,so...
Global VO={
foo:10,
func:
}
Activation Object(AO)
When a function is activated (called) by the caller, a special object, called an activation object is created.
It’s filled with formal parameters and the special arguments object (which is a map of formal parameters but with index-properties). The activation object then is used as a variable object of the function context.
A function’s variable object is the same simple variable object, but besides variables and function declarations, it also stores formal parameters and arguments object and called the activation object.
function foo(x,y){
var z=30;
function bar(){};
}
foo(10,20);
//当执行到foo(10,20)时即会产生AO
Activation Object={
z:30,
x:10,
y:20,
bar:,
arguments:{0:10,1:20,length:2}
}
function factory(){
var name="laruence";
var intro=function(){
console.log("I"m "+name);
}
return intro;
}
function app(para){
var name=para;
var func=factory();
func();
}
app("eve");
摘要:不是引用类型,无法输出简而言之,堆内存存放引用值,栈内存存放固定类型值。变量的查询在变量的查询中,访问局部变量要比全局变量来得快,因此不需要向上搜索作用域链。
赞助我以写出更好的文章,give me a cup of coffee?
2017最新最全前端面试题
基本类型值有:undefined,NUll,Boolean,Number和String,这些类型分别在内存中占有固定的大小空...