childNodes is not working in JavaScript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

childNodes is not working in JavaScript

Hi Everyone, I am not able to run queries against the Node related DOM methods such as hasChildNodes,ChildNodes,parentNode etc. I am not sure if this is my machine problem or if there is any issue with my code. Please help. Code is here: https://code.sololearn.com/Wz0Hqy6oMjf9/#js

27th Aug 2020, 8:21 AM
Nagesh Jorrigala
Nagesh Jorrigala - avatar
4 Answers
+ 1
you keep assigned childNodesText to a new value insde loop. https://code.sololearn.com/Ww2MW6rbirrD/?ref=app
27th Aug 2020, 9:24 AM
Rei
Rei - avatar
+ 1
hasChildNodes is a function, so use () parentNode and childNodes is not a function, remove ()
27th Aug 2020, 8:51 AM
Rei
Rei - avatar
0
I have updated changes as you suggested. Still not getting required output
27th Aug 2020, 9:06 AM
Nagesh Jorrigala
Nagesh Jorrigala - avatar
0
Thank you for your help.. I was able to fix the code.
27th Aug 2020, 3:06 PM
Nagesh Jorrigala
Nagesh Jorrigala - avatar