HELP! Your second "for" loop 5


#1

Can someone help me with the second for loop. I am getting this error message "SyntaxError: Unexpected token ')'. Expected a ';' after the for loop condition expression."

Tell me I am doing wrong. My code is below:

var text = "Thuy is cold. Thuy have a \ headache. Numbly Pounding. Thuy want \ some peppermint hot chocolate. Thuy \ is craving for cookies, brownies, and \ ice cream.";

var myName = "Thuy";

var hits = [];

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


#2

recheck that line for errors

Also

j is just a number and it represents a valid index of a character in the target text. That is what you want to push to hits


#4

I figured out the correct code, but can someone please explain it to me for more understanding...

/*jshint multistr:true */

var text = "Thuy is cold. Thuy have a \ headache. Numbly Pounding. Thuy want \ some peppermint hot chocolate. Thuy \ is craving for cookies, brownies, and \ ice cream.";

var myName = "Thuy";

var hits = [];

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