Can someone please explain me why this happened? | SoloLearn: Learn to code for FREE!

0

Can someone please explain me why this happened?

HELLO I’M TRYING TO LEARN JAVASCRIPT AND THIS IS SIMPLE BUT I CAN’T UNDERSTAND WHY IN THIS FOR THE ARRAY DOES NOT START IN THE FIRST INDEX: let friends = [“John”, “Peter”, “Nancy”]; for(var I = 0; I<friends.length; I++){ document.getElementById(‘div’).innerHTML = amigos[I]; }

7/11/2020 9:46:58 AM

Oliver Reyes

3 Answers

New Answer

+2

if i'm right its only showing Nancy to print them all try using += amigod[I] instead of = amigos[I]

+2

Your array is named <friends>, but you try to access <amigos> which is undefined. I'm guessing you meant `friends[i]` instead of `amigos[i]` there.

0

man thank’s