Getting Error on This Exercise


I am getting the 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."

I've even copied the working code from the beginning of the lesson but still getting an error.

/*jshint multistr:true */
var text = "blah blah Sean \
blah blah Sean blah blah \
 blah blah";
var myName ="Sean";
var hits = [];

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


Hi this for loop

for(var i = 0; i > text.length; i ++)

this part

i > text.length

you shoudl change the > with < ......because i will never be great than text.length


Thanks so much! This was it.


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