Question about second loop


#1

my code is here:
/*jshint multistr:true */
var text = "Blah Blah Blah Blah Blah Blah Alice \
Blah Blah Blah AliceBlah Blah Blah ";
var myName = "Alice";
hits = [ ];

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

When I submit, the information is "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 have tried my best but cannot find the mistake. Could you help me to deal with it? Thanks!


#2

@ds_ssj,
Your comparison

(text[i] === "Alice")

is not functional,
as with a text[i] you only have 1 character
and you are comparing this character with "Alice"


#3

Oh, it can pass, thank you!