Your second "for" loop. I can't do it. Dang


#1

I looked at some other posts and I couldn't figure it out, please comment if you could help me out. It freezes the browser when I run the code.

var text = "Joseph Camyre is really cool because I heard that Joseph told Joseph that Joseph is pretty neat.";
var myName = "Joseph";
var hits = [];
for (var i = 0; i < text.length; i++) {
if(text[i] === "J") {
for(var j = i; i < myName.length; j++) {
hits.push("Joseph")
}
}
};


#2

@j_camyre,

You will want to change the condition in your 2nd FOR loop
like

(var j = i; j < i + myName.length; j++)

#3

Thank you so much, It would have took me forever!