Question · JavaScript and TypeScript course · Module 8: Events and the DOM

Quiz: Removing Event Listeners

Why is it important to remove event listeners when an element is removed from the DOM?

Answer options

  • To speed up page rendering
  • To reduce the JavaScript file size
  • To prevent memory leaks
  • To avoid compilation errors

You can check the correct answer by solving this task in the CodeWorlds game.