DEV Community

Discussion on: Is "this" really that complicated in JavaScript?

Collapse
 
codyseibert profile image
Cody Seibert

When you are inside a function invoked by a dom event, such as clicking a button, this refers to the element clicked. Or invoking a function that was created with a "bind" somewhere else in your codebase, you have no clue what this might equal. Yeah, so this keyword can be pretty confusing because its value can be so arbitrary at times. Thanks for the article!