+ 1
Why the arr.length is equal to 5 even though the there are only two child nodes of div id demo??
3 ответов
+ 1
Plus 3 text nodes.
+ 1
What are text nodes?
+ 1
childNodes includes all child nodes—including non-element nodes like text and comment nodes. To get a collection of only elements, use ParentNode.children instead.