5. Your second "for" loop


#1


I need your help...
I'm getting an error message "It looks like your second 'for' loop isn't pushing values to the hits array. Make sure it's working properly and that myName's text appears somewhere in the text variable."

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


#2

this line:

for(var i= 0; i< text.length; i++); <- semi-colon here

having a semi-colon like that, at the end of a for loop, means the for loop never gets executed


#3

Thank you for the explanation! It works now.
Learning something everyday... appreciate it