TLDR Web Dev · ARTICLES & TUTORIALS

JAVASCRIPT, WHEN IS THIS?

piccalil.li9 min read

Summary from the TLDR Web Dev newsletter

JavaScript's `this` keyword refers to the object bound to a function at the time of calling, not when the function is written. Unlike regular variables, `this` is determined by how a function is invoked (as a standalone function, method, or constructor), which is why the same function can have different `this` values each time it's called.