5. Your second "for" loop is not turning out


I'm not understanding this. I keep going over it and it looks right, but I keep getting the same error.

Oops, try again. Careful: your second 'for' loop should stop when it reaches its current point in the string + myName.length.

var text = "I love you";
var myName = "Selina";
var hits = ["Selina"];

for (var i = 0; i < text.length; i ++){} 
    {for (var i = 0; i > myName.length; i ++)


Your second loop is not correct:

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

Why did you use var i again. You wanna start the second loop from the position where you found 'S' in your first loop. So it must be something like var j = i. Next thing you know the lenght of your name and you know the position from the first letter of your name ( var i) that gives you how loften the second loop must run. j < (myName.length + i)

    console.log(myName); // remove

S is no var what do you try here? You wanna push every single letter from your name in this array.
You should know now var j is the first and all coming letters from your name now. Change that too



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