5. Your Second For Loop


#1

/*jshint multistr:true */
var text = "Hey my name is Allison. How are you?";
var myName = "Allison";
var hits = [];
for(i=0; i < text.length; i++) {
if(text[i]==="A") {
for(var j=i; j < i + myname.length; j++) {
hits.push(text[j]);
}
}
}

I get the message: Oops, try again. Careful: your second 'for' loop should stop when it reaches its current point in the string + myName.length.

Not sure what I've done wrong. Thanks in advance.


#2

in your second for loop, myName should have a uppercase N


#3

@stetim94 That's my cue for a coffee break. Thank you!!