js this的指向问题

话分两头

ES5    this指向调用的对象

1. 直接调用一个函数

 

2 换成对象  这个时候指向的是对象a

3 闭包函数 匿名

 

 

 4.闭包函数 

 

 

 

 

 ES6    this指向定义的函数