Question · JavaScript and TypeScript course · Module 8: Events and the DOM
Quiz: Handler Reference
Why must the same function reference be passed to removeEventListener as was used in addEventListener?
Answer options
- Because the browser caches functions by name
- Because removeEventListener only accepts named functions
- Because JavaScript compares function references, not their source code
- Because anonymous functions cannot be event handlers
You can check the correct answer by solving this task in the CodeWorlds game.