this is the context, it is necessarily contextual as opposed to being lexical. The old idiom is using var self = this; in the preamble of a function that wishes to expose it’s context to functions it defines. The current idiom is using arrow functions whose context is their parent’s context
Wait, what? I write JS daily and I still thought an arrow function was just syntactic sugar for a regular function, and behaviorally identical. Wild.
I guess my habit of basically-never passing ’this’ into nested functions (and explicitly using .bind or .call every time when I need to control ‘this’) has been more beneficial than I knew.
this is the context, it is necessarily contextual as opposed to being lexical. The old idiom is using var self = this; in the preamble of a function that wishes to expose it’s context to functions it defines. The current idiom is using arrow functions whose context is their parent’s context
Wait, what? I write JS daily and I still thought an arrow function was just syntactic sugar for a regular function, and behaviorally identical. Wild.
I guess my habit of basically-never passing ’this’ into nested functions (and explicitly using .bind or .call every time when I need to control ‘this’) has been more beneficial than I knew.