Creating never ending loops


I've been having trouble with this code, creating never ending loops. Any help?

/*jshint multistr:true */

var text= "huolj jju rde\ rfcm uyin frfcr Zach\ jruxd fjhrui\ cjnzis j Zach jdj\ jksdujfj cjnm Zach";

var myName= "Zach";

var hits=[];

for(var i=0; i< text.length; i++){
if(text[i]=== 'Z'){
for(var j=i; i< i+myName.length; i++);

Your second 'for' loop

There are two major errors in the above:
1. i < ...
2. i++);

It should read,

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


What @mtf said up there and the fact that you have to push your array.. for the task... Like this:



Sorry for the late reply, but all of that helped! Thank you everyone!