Web APIs

Node.childNodes

Try the free JavaScript compiler

A document is a tree of nodes. Elements are one kind of node; text and comments are nodes too. children lists element children, while childNodes includes text and comments.

Formal Syntax & Structure

javascript syntaxjavascript
node.childNodes

Return Value

NodeList

Live collection of child nodes.

Working Example

Example Snippetjavascript
const p=document.createElement("p"); p.append("Hello",document.createElement("strong")); console.log(p.childNodes.length,p.children.length);
JavaScript Reference