Functional
Beginner 2 min read
Arrow Functions & `this`
Why arrow functions don't have their own `this`
JS Academy
JavaScript Engineer
Arrow functions do not have their own `this` binding — they capture `this` lexically from the surrounding scope at the time they are defined. This makes them ideal for callbacks inside methods, where you want to preserve the outer object's context. Regular functions, by contrast, get a new `this` determined by how they are called. Avoid arrow functions for object methods or constructors, since they cannot be used with `new`.
#javascript
#arrow-functions
#this
#scope