Open heejunghwang opened 8 years ago
object arrow 에서의 this는 왜 window일까요?
var obj = { a:()=>{console.log(this)} } obj.a() //result : window
http://www.2ality.com/2012/04/arrow-functions.html 번역해서 확인해볼 것
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this#Arrow_functions
예제의 var foo = (() => this); 에 하나를 더 추가해서 var fooFn = function() { return this; }; 두개를 비교해보면 이해가 편함 결론적으로 모호성이 없어짐
object arrow 에서의 this는 왜 window일까요?
var obj = { a:()=>{console.log(this)} } obj.a() //result : window