function fn(a,c){
console.log(a); //function a(){}
var a=123;
console.log(a); //123
console.log©; //function c(){}
function a(){} //预编译已经处理,第二次js解释时不看
if(false){var d=678} //变量声明提升
console.log(d); //underfined 没有走if语句里面
console.log(b); //var b=function(){}他是函数表达式,不是函数声明,在这里只存在变量提升,underfined
var b=function(){}
console.log(b); //function b(){}
var c=111;
function c(){} //预编译已经处理,第二次js解释时不看
console.log©; //111
}
fn(1,3)
//预编译
//作用域的创建阶段 预编译的阶段
//js的变量对象 AO对象 供js引擎自己去访问
//1.创建了AO对象
//2.找形参和变量的声明 作为AO对象的属性名值为underfined
//3.实参和形参相统一
//4.找函数声明 并覆盖变量的声明
// 注意:函数声明是function a(){};函数表达式为 var b=function(){}
// AO:{
// a:underfined 1 function a(){};
// c:underfined 2 function c(){};
// d:underfined;
// b:underfined;
// }
//预编译阶段结束;
//JS的解释执行,逐行执行->(接代码注释)
js预编译
最新推荐文章于 2024-08-11 18:40:36 发布