#5 What am I doing wrong?!


#1

I keep getting this as my error.

SyntaxError: Unexpected token ';'. Expected ')' to end a 'if' condition.

Heres my code:

/*jshint multistr:true */

var text = " Blah BLah Blah Blah BLah Blah\
Blah BLah Blah Tyler Blah BLah Blah Tyler." ;
var myName = "Tyler";
var hits = [];

for(i = 0; i < text.length; i++){
if (text[i] === "T"){
if (j = i; j < myName.length + i; j++)
hits.push(text[j]);
}
}

Thank you very much for your help!


#2

nevermind I have figured out my error!!!! I did a if statement instead a for loop


#3

for(i = 0; i < text.length; i++){     
if (text[i] === "T"){
if (j = i; j < myName.length + i; j++)     // this is supposed to be a for loop not an if statment. (Also wrapping myName.length + i in parentheses will be even better )
hits.push(text[j]);
}
}
// you forgot to close the first for loop