Outcome is supposedly correct but it's completely wrong


#1


Search text for your name


My code spews out " [ '.', ' ', undefined ] " as an outcome while it's supposed to look up the name Emily. Codeacadamy is telling me that I did a good job and it went well, so what's wrong with this thing? It definitely isn't looking up Emily. Can anyone help?


/*jshint multistr:true */
var text = "Hey how are you doing? My name is Emily. I love goblins and Emily and my name is Emily";
var myName ="Emily";
var hits =[];
for(var i=0; i<text.length; i++) {
    if (text[i]=== "E") {
        for (var j = i; j < (i + myName.length); j++);{
            hits.push(text[j]);
    }
}
}
if (hits.length === 0) {
    console.log("Your name wasn't found in the text")
}
else {
    console.log(hits);
}


#2

Do you see an error on this line?


#3

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