Web APIs
Element.children
Expose a live collection of direct child elements, excluding text and comment nodes. Example console output: 1 2.
Formal Syntax & Structure
javascript syntaxjavascript
element.childrenReturn Value
HTMLCollection
Direct child elements.
Working Example
Example Snippetjavascript
const root=document.createElement("div"); root.append("text",document.createElement("span")); console.log(root.children.length,root.childNodes.length);