Second 'For' loop Help


#1

I don't know if it's just me, but I can't figure out what I'm doing wrong here.
Help would be greatly appreciated :grinning:


/*jshint multistr:true */

var text = "Dhuiwuh uwiufwhien Derf feiywefguewyfeb ruyfjwhegabufj wffwygfegwyuefwfwhkhewfehwfefwgjefwhgfewghefghjwghjfewghjwefghfewghefwhgefwhhfewjghgjfewhjgefwhj eric fefuhefewuhi";
var myName = "Derf";
var hits = [];

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


#2

In the first for loop you will have to add i < text.length instead of i === text.length;

In The second for loop comparison of j should be something like this:

j < (myName.length + i)