Why did the alert appear more than 2 times? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why did the alert appear more than 2 times?

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

14th Aug 2019, 4:07 AM
John Carlo A. Albores
John Carlo A. Albores - avatar
2 Answers
+ 3
://Because alert is inside for loop, it will alert until x =5, because inside for loop there is x<arr. length;x++, and arr.length is 5 so x will be alert 5 times
14th Aug 2019, 5:13 AM
Sudarshan Rai
Sudarshan Rai - avatar
0
Ohhh so what is the elements inside the demo? I thought there are only two as demo has 2 child elements which are the 2 paragraphs? Sorry I am little confused 😖
14th Aug 2019, 5:25 AM
John Carlo A. Albores
John Carlo A. Albores - avatar