本文章通过代码的运行来描述 this 的具体指向: 默认绑定 场景一: console.log('普通情况', this) // window 在普通状态下, this 指向的是全局变量 window 场景二: function foo() { console.log('普通函数体', this)} foo() // window 在函数体内, this 也是指向全局变量 window 结论一: 在正常,无任何调用的...
本文章通过代码的运行来描述 this 的具体指向: 默认绑定 场景一: console.log('普通情况', this) // window 在普通状态下, this 指向的是全局变量 window 场景二: function foo() { console.log('普通函数体', this)} foo() // window 在函数体内, this 也是指向全局变量 window 结论一: 在正常,无任何调用的...