Put in order · JavaScript and TypeScript course · Module 8: Events and the DOM

Modal component lifecycle

Order the stages of a modal component's lifecycle (top to bottom):

Items to put in order

  • Create the element with createElement
  • Add the modal to the DOM (appendChild)
  • Call destroy() and remove listeners
  • Register listeners (close, Escape)

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