全局作用域和函数作用域,基本概念大家应该都知道,这次总结一下深层次的作用域

function fn(a, c) {
console.log(a) // function a() { }
var a = 123
console.log(a) // 123
console.log(c) // function c() { }
function a() { }
if (false) {
var d = 678
}
console.log(d) // undefined
console.log(b) // undefined
var b = function () { }
console.log(b) // function () { }
function c() { }
console.log(c) // function c() { }
}
fn(1, 2)
// 1. 创建ao对象 AO{}
// 2. 找形参和变量声明 将变量和形参名 当做 AO对象的属性名 值为undefined
// 3. 实参形参相统一
// 4. 在函数体里面找函数声明 值赋予函数体
// AO{
// a : undefined 1 function a() { }
// c : undefined 2 function c() { }
// d : undefined
// b: undefined
// }