Why is childNodes.length for each category 5 when it should be 2? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why is childNodes.length for each category 5 when it should be 2?

https://code.sololearn.com/W6LOkr12Y60T/?ref=app

16th Mar 2022, 7:33 PM
Margaret Guzman
Margaret Guzman - avatar
1 Answer
+ 1
Because you also have 3 text nodes Even if (like yours) texts are not inside any element, they are still nodes
16th Mar 2022, 7:48 PM
Toni Isotalo
Toni Isotalo - avatar