//创建全局作用域----》预解析工作----》创建全局的执行上下文---》执行上下文环境-----》全局变量对象{a:undefined, this:window}---》作用域链
var a=123;
var b='abc';
//先定义--》创建局部作用域---》函数自身有一个[[scopes]]:上一级作用域链global
function fun(){
//创建局部执行上下文---》局部变量对象{a:undefined,fun2:function,this:window}---》创建作用域链[局部变量对象,global]
var a=234;
var c=345;
console.log(a);
console.log(b);
//fun2函数已经定义了---》创建局部作用域(fun2)---》函数自身有一个[[scopes]]:上一级的作用域链[fun的变量对象,global]
function fun2(){
//创建局部执行上下文---》局部变量对象{this:window}---》创建作用域链:[fun2的局部变量对象,fun的变量对象,global]
console.log(c);
console.log(d);
}
fun2();
}
fun();