Your first "for" loop


#1

hi everyone,

can anyone see what is wrong with this code please.

/*jshint multistr:true */

var text = "Hey, how are you \
doing? My name is Emily blah \
blah blah blah blah blah Aaron.\
blah blah blah blah Aaron";

var myName = "Aaron";

var hits = [];
for(var i = 0; i < myName.length; i++) {

}

#2

you loop over the length of your name:

myName.length

you should use text.length since you want to loop over text to find all instances of your name


#3

thank you.

was stuck for ages