- 博客(1)
- 问答 (1)
- 收藏
- 关注
原创 js this指向问题
var a = { c: '123456', fun(){ console.log(this); console.log(this.c) } } var b = a.fun; a.fun(); // 打印出 a对象 123456 window.a.fun() b(); // 打印出 window对象 undefined window.b() js中this指向的是最后一个调用它的对象 a.fun()也可以写成window.a.fun(); 最后一个调用fun()的对象是a 继而th
2020-08-12 15:14:41
169
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅