5. Second for loop cannot understand why I'm getting error


#1



Hello,
I am on the second for loop and I keep getting the error that the loop is not pushing the chars to the array. I read through several other people with the same problem's threads, but I cannot see where my mistake is at. I would appreciate it if you took a look and had some feedback.


var text = "What up buddy? what's your name? \
George, that's cool, George, what kinda name \
is George anyways?";
var myName = "George";
var hits = [];
for(i=0;i > text.length; i++)
{
    if(text[i] === myName[0])
    {
        for(j = i; j < (i + myName.length); j++)
        {
            
            hits.push(text[j]);
            
        }
    }
}


#2

Please look at the statment 2 in your first for Loop.
Why this Loop should only run if i > text.length;
That is wrong. Change that at it will run :slight_smile: