本文共 712 字,大约阅读时间需要 2 分钟。
function fn(a,c){ console.log(a); var a = 123; console.log(a); console.log(c); function a(){ } if(false){ var d = 678; } console.log(d); console.log(b); var b = function(){ } //函数表达式,不是函数声明,所以不会覆盖 console.log(b); function c(){ } console.log(c);};fn(1,2);// function a// 123// function c// undefined// undefined// function b// function c// 预编译作用域的创建阶段 预编译的阶段预编译的时候做了哪些事情js的变量对象 AO对象 供js引擎自己去访问的1 创建了AO对象 2 找形参和变量的声明 作为AO对象的属性名 值是undefined 3 实参和形参相统一 4 找函数声明 会覆盖变量的声明AO:{ a: undefined 1 function a(){ } c: undefined 2 function c(){ } d: undefined b: undefined}
转载地址:http://auch.baihongyu.com/