this binding Playground

Rizal writes a tally on whatever scoreboard this is: counter.inc(), call(other), hung as the kentungan’s click handler, called bare, or bound; the call site…

Why it matters

"this is undefined" is one of the most confusing JS errors for beginners. The key: this is not tied to where a function is written, but to the call site. Once you see that, callback and event handler bugs read themselves.

The key idea

this is decided by HOW it is called, not where it is written

Common mistakes

Try it in this playground