Understanding the `this` Keyword in JavaScript

The most confusing word in JavaScript — explained by asking one simple question. If there's one concept that made me stare at my screen in genuine confusion, it's this. Not because the idea is complicated, but because this changes its meaning depending on where and how you use it. The same keyword can refer to completely different things in different situations. I'd write this.name inside a function and get undefined. Then I'd write the exact same thing inside an object method and get the c...

Original Source

Read the full article at Dev →

KhanList aggregates and links to publicly available news content. We do not host full articles from third-party sources. Always verify important information with original sources.