Skip to content

变量提升和闭包 ​

本节目标:理解“变量提升和闭包”的核心思路,并能把它用于实际开发或面试表达。

function f() {
    console.log('a')
}
var f = function () {
    console.log('b')
}
f();
var a = {};
var b = {
    key: 'b'
}
var c = {
    key: 'c'
}
var d = ['d'];
a[b] = 1;
a[c] = 2;
a[d] = 3;
console.log(a[b]);
console.log(a[c]);
console.log(a[d]);

本站总访问 — 次