Stuck 5/7


#1

Hello there,

Can someone help me out please, im getting a syntax error:

var hits = [];

for (var i = 0; i < text.length; i= i + 1) {
    if (text[i] === "H") {
        if (var j = i; j < (i + name.length; j++) {
                hits.push(text[j]);   
        }
    }
}

#2

Try to use "for", not "if" here:

Also remove the second "(" on the same line.


#3

I actually had it as a for loop then forgot to change it to an if. The for loop is not working as well, syntax error.


#4

Are your parenthesis right?

for (var j = i; j < i + myName.length; j++) {
   hits.push(text[j]);
}

#5

Thank you Julie :-).

Fixed up.