Event Listeners
8 min · JavaScript
Run code when something happens — the same pattern that powers clicks on the web.
JavaScript · Event Listeners0/5 cleared
Enemy 1 of 5
On a web page, addEventListener('click', handler) runs handler when the user clicks. The idea is the same everywhere: register a function, call it when an event fires.
Node's EventEmitter uses the same pattern — .on() registers, .emit() fires — so you can practice it here in the runner.
You
Cargo Cultist
Loading editor...
Ln 1, Col 1Spaces: 4
Sign up to fightTarget output: Clicked!