``` javascript var A = { test: () => {this} }; ``` why is **this** in code above translated to **undefined** instead of pointing to object itself?
Activity
sebmck commentedon Feb 17, 2015
Because you're using a fat arrow function and it infers to the outer
this.sebmck commentedon Feb 17, 2015
Duplicate of #733 and babel/babelify#37.
gko commentedon Feb 17, 2015
I know about arrow functions, but wouldn't the «outer this» be object in this case?
sebmck commentedon Feb 17, 2015
The outer this is
undefined.gko commentedon Feb 17, 2015
It depends on where do you execute function. I.e. outer this can be window object.
sebmck commentedon Feb 17, 2015
Nope. In ES6 modules the top
thisisundefined.sebmck commentedon Feb 17, 2015
See #562.