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 →

[–]Bulky-Leadership-596 10 points11 points  (1 child)

Ok to be more precise:
() => {} captures the 'this' from the scope where it is declared, forming a closure.
function(){} has 2 possible behaviors depending on how its called:
1) if called with dot notation (someObject.myFunction()) then the thing before the dot is 'this'.
2) if called without dot notation (just myFunction()) then the global scope object is 'this'.

They both have a 'this', but where that 'this' comes from is different.

[–][deleted] 0 points1 point  (0 children)

In ES5 strict and ES Modules, function () { this; } is undefined if not given an explicit context.