5. Your second "for" loop


#1


Oops, try again. 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.


Replace this line with your code. 
/*jshint multistr:true */

var text = "asdasdasdas asdasdasda dad asd ad das dsad asd asdas dasd josh dasdsdasddasd";

var myName = "josh";

var hits = [];

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


#2

Thanks for no help. 10/10 don't recommend


#3

the condition in your first for loop:

i == text.length

this is suppose to loop over text, so until the length is no longer smaller. use < instead

This is a forum? replies may take some time


#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.