Second 'For' Loop help


#1

I have no idea what I'm doing on this one and I have no idea what I'm supposed to do. Super confused. Here's my code and I'd love some help. Thanks

var text = "this is some text";
var myName = "Josh";
var hits = [];

for ( i=0; i < text.length; i++ ) {

if (text[i] === 'J') {

    for (var j = i; j < myNamelength; j++) {


    }

    hits.push(text[j]);

}
else {

}

}


#2

@tagjumper33015,

You will have to insert the hits.push(text[j])
within the 'second' FOR-loop
like

for (var j = i; j < myNamelength; j++) {
    hits.push(text[j]);
}

#3

Did that and it didn't work. =/


#4

Part of the issue is you do not have your name listed in the text variable. Also for your second for loop you need to have,

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

You are missing the (+ i) portion as well as the (.) in .length. This one took me a while of reading through it and playing with the code to figure it out as well.