Help


#1

Error:
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.

my code:
/*jshint multistr:true */
text = "blah blah Lars blah blah blah blah Lars blah Lars"
myName = "Lars"
hits = [];

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


#2

That error message is triggered by hits being empty, so it would appear that you aren't pusing anything into it. Something to do with your conditions perhaps? I'd add some prints in there to find out what was going in - I'd start by adding one at the end confirming that the hits array is empty so I know that's the problem before trying to solve it.