+ 1

for loop code is returning me undefined.

My For Loop Code is returning me undefined for some reason I don't know at all. I know I am doing something wrong here. So, Please help me and please me an explanation too. https://code.sololearn.com/W50pjES7J2Wr/?ref=app

13th Nov 2021, 2:04 PM
Manvendra Rajpoot
Manvendra Rajpoot - avatar
2 Respuestas
+ 1
Array Index starts from 0 so max index is array.length-1 So use condition a<num.length instead of a<=num.length
13th Nov 2021, 2:18 PM
Jayakrishna 🇮🇳
+ 2
Thanks it's solved now.
13th Nov 2021, 2:19 PM
Manvendra Rajpoot
Manvendra Rajpoot - avatar