Nearby lessons

14 of 14

JavaScript HTML DOM Node Lists

📌 What are DOM Node Lists?

NodeList is a collection of document nodes returned by DOM methods like querySelectorAll() or childNodes. It looks like an array but is not a true array.

📄 The HTML DOM NodeList Object

The NodeList object represents a collection of nodes returned by DOM methods like:

  • document.querySelectorAll()
  • element.childNodes

Unlike HTMLCollection, NodeList can contain any type of nodes: element nodes, text nodes, comments, etc.

Example02
🧩Code Cell
Loading Editor...
✏️ You can edit this code — click Run to refresh the preview.
Output

🔄 Looping Through a NodeList

You can loop through a NodeList using for, for...of, or forEach() if it's supported.

Example03
🧩Code Cell
Loading Editor...
✏️ You can edit this code — click Run to refresh the preview.
Output

🧠 Test Your Knowledge

3 Questions
Progress: 0 / 3