Understanding Functions and "this" in the World of ES2018
summary
Explains that JavaScript sets this by how a function is called — call-site determines this — so plain function calls get global/window, object.method calls get the object, and callbacks like setTimeout lose the object. Covers call/apply/bind, shows arrow functions lexically bind this (call/apply/bind don’t affect them), notes the surprising ignored this when calling an arrow via call, and previews class field declarations with arrow methods to avoid React binding boilerplate and extra re-renders.
AI-written summary · about
chapters (7)
- 0:00Start
- 8:42Function Expressions vs. Declarations
- 12:10Named Function Expressions
- 17:19Object Shorthand Notation
- 28:10Class Field Declarations (Stage 3)
- 38:27The Proper Way
- 52:00Class Field Arrow Functions and React
related talks
15mthis: taking JavaScript out of Context
09mWhat is 'this' in Vue?
51mECMA 6 JavaScript, the Good Parts
54mThe New Dragons in JavaScript
01h 14mJavaScript the Grumpy Parts
54mJavaScript Essentials for Programming with React
39mJavascript for people who didn't learn Javascript
44mThings that every JavaScript developer should know
