javascript中this的指向

**构造函数内部原理**内部隐式运行

1. 在函数体最前面隐式的加上 var this = {}
1. 执行this.xxx = xxx;
1. 隐式的返回this

**this**一般指向

1. 函数预编译过程 this --> window
1. 全局作用域 this --> window
1. call/apply可以改变函数运行时this指向
1. obj.func(); func()里面的this指向obj
posted @ 2018-03-12 22:47  自由影子  阅读(125)  评论(0)    收藏  举报