this指向问题在这里插入图片描述
1.函数预编译过程中this走的是预编译环节,指向window,预编译过程参见上图AO,有new关键字,this指向object.prototype见上二图,上图三中this==undefind,因为里面没有a;
2.全局环境this–>指向window
3.call和apply会更改this的指向
4.obj.fun(),fun()里面this指向obj;
js预编译过程与this指向的问题
最新推荐文章于 2021-06-04 11:30:12 发布