Glossary term
What is event listener? Meaning for developers
A callback attached to an element with addEventListener. It holds a closure over its surroundings, which is why forgetting to remove one can leak memory.
Learn it properly · JavaScript CoreLesson 12: First-Class Functions, Callbacks and Event ListenersFunctions as values: passing them as arguments, returning them from other functions, sync vs async callbacks stepped side by side, and attaching and removing event listeners without leaking memory.