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

DocumentFragment

Why is DocumentFragment more efficient than multiple appendChild calls?

Answer options

  • DocumentFragment automatically compresses elements
  • DocumentFragment works asynchronously
  • DocumentFragment is newer and faster by definition
  • It allows preparing elements in memory and adding them in a single DOM operation, minimizing reflow

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