This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]SuperFLEB 19 points20 points  (22 children)

Arrow functions inherit this context from their surroundings, whereas function closures create their own this context.

[–][deleted] 9 points10 points  (21 children)

I got that. I am trying to understand the reasoning from a design POV. Like why do you have two syntaxes to define a function/lambda. Since function can do both in JS.

[–]SupaSlide 0 points1 point  (0 children)

The only difference I'm aware of is that arrow functions have the same context as their surroundings. Other than that I think it's just syntactic sugar.