Your Second for loop


#1

Hi guys, can anyone help me figure out whats wrong with this code? I get a SyntaxError: Unexpected Token } Thanks!!!

var text = "Borris ,Borris, Borris";
var myName = "Borris";
var hits = [];
for (var i = 0; i < text.length; i++){
    if (text[i] === "B"){
        for (j = i; j < myName.length; i + myName.length) 
    }
    hit = [];
    hits.push("Borris");
    hits[0];
}

#2

Maybe you can look at dozens of other people wrestling with this one on this forum.

In the second for loop you test for j < myName.length. Remember you are processing text and not myName here. You are working somewhere in text starting at i. So the 2nd phrase should be j < i + myName.length. The third is in error. This should just be j++ adding 1 to the index


#3

Looking at taking care of this error message:

When you set-up your second for loop, I would expect to see a { after the for ( ... ) but that loop doesn't seem to have any { ... }. You need to put the work that you want that loop to do inside { ... }.