Javascript this
Interpretation on this
thisThe 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
thisin current context, MUST use arrow function() => {};If you want to use
thisin some other context, late binding, usefunction(){}
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
Was this helpful?