04 2023 档案
摘要:var obj = { id: "awesome", cool: () => { // 普通函数this是在运行时确定的,而箭头函数绑定了上层函数或window的this console.log(this.id); } }; var id = "not awesome"; obj.cool(); /
阅读全文
摘要:在条件控制语句中的函数声明解释器在编译阶段无法识别并提升,执行阶段才会被声明存在 foo(); // TypeError: foo is not a function var a = false; if(a) { function foo() { console.log("a"); } } else
阅读全文