Having trouble passing "our first "for" loop"


#1

So I am stuck on "our first "for" loop" exercise

"So I am getting this error, Oops, try again. Does your 'for' loop iterate until it hits text.length? Check the Hint if you need help!" and I am completely lost on what to do. I set my code to write down my name in characters and numbers via arrays. What should I do to pass this

Replace this line with your code. 

var myName = "Kevin Nguyen"
var text = "Hey how are you" + myName
var hits = []

for (var i = 0; i<myName.length; i++)
{
    console.log(i)
}

// I also tried the code below as well

console.log(myName[i])


#2

Nevermind I'm an idiot. It was supposed to be "Text" var not "myName" whoops..


#3

text.length

your loop:

for (var i = 0; i<myName.length; i++)

myName.length

myName.length != text.length


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.