DEV Community

Discussion on: Let me explain to you what is `this`. (Javascript)

Collapse
 
joshcheek profile image
Josh Cheek

This was really good :) In the flow chart, I don't think the arrow function's this is the caller's, I think it's the this at the time of construction. Eg:

$ node -p '({magic: function() { return () => this }}).magic()()'

The this will be bound to our magic object, where the arrow fn was created, not to global, where it was called.

Collapse
 
ycmjason profile image
YCM Jason

Oh yes you are right, let me update it later. Thanks for the shout! 😁😁😁

Collapse
 
ycmjason profile image
YCM Jason

I have changed "caller" to "definer", which makes more sense.

Thank you so much! :)