Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

object arrow 에서의 this #2

Open
heejunghwang opened this issue Sep 27, 2016 · 2 comments
Open

object arrow 에서의 this #2

heejunghwang opened this issue Sep 27, 2016 · 2 comments

Comments

@heejunghwang
Copy link
Contributor

object arrow 에서의 this는 왜 window일까요?

var obj = {
a:()=>{console.log(this)}
}
obj.a() //result : window

@heejunghwang
Copy link
Contributor Author

heejunghwang commented Oct 8, 2016

http://www.2ality.com/2012/04/arrow-functions.html
번역해서 확인해볼 것

@youngbeomrhee
Copy link

youngbeomrhee commented Oct 15, 2016

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this#Arrow_functions

예제의 var foo = (() => this); 에 하나를 더 추가해서 var fooFn = function() { return this; };
두개를 비교해보면 이해가 편함
결론적으로 모호성이 없어짐

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants