<div>hi<div>there</div>var el = document.getElementsByTagName("div"); document.write(el.length); | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

<div>hi<div>there</div>var el = document.getElementsByTagName("div"); document.write(el.length);

What's the output and how?

24th Apr 2021, 6:07 AM
Rohit Ahuja
Rohit Ahuja - avatar
1 Answer
+ 6
Hello there! I made a small code where I explained a bit your code and how the output is. For any further explanation or if something isn't clear just let me know. :) https://code.sololearn.com/Wz08Vk1GK3Ec/?ref=app
24th Apr 2021, 7:19 AM
Matthew
Matthew - avatar