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);
//當執(zhí)行到foo(10,20)時即會產(chǎn)生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");
摘要:不是引用類型,無法輸出簡而言之,堆內(nèi)存存放引用值,棧內(nèi)存存放固定類型值。變量的查詢在變量的查詢中,訪問局部變量要比全局變量來得快,因此不需要向上搜索作用域鏈。
贊助我以寫出更好的文章,give me a cup of coffee?
2017最新最全前端面試題
基本類型值有:undefined,NUll,Boolean,Number和String,這些類型分別在內(nèi)存中占有固定的大小空...