DEV Community

Discussion on: What's the worst part about the JS ecosystem?

Collapse
 
michaelcurrin profile image
Michael Currin

Yeah this works differently in function and arrow function (not allowed in latter I think).

I found a video which explained this and there are some many cases where it behaves weird.

And then you assign var _this = this to get some context frozen...

Collapse
 
peerreynders profile image
peerreynders

there are some many cases where it behaves weird.

Don't expect JavaScript's 'this' to be a 'this' that you are already familiar with.

It's its own thing.

xkcd