Javascript this

Interpretation on this

The binding this in javascript can be interpretated as, if there is a this pointer in function:

  • If you want to passing function around, or ensure using this in current context, MUST use arrow function () => {};

  • If you want to use this in some other context, late binding, use function(){}

To make things even easier, rules (almost a silver bullet) can be:

ONLY use function(){}, if you want to use a late bound this.

Last updated