Finished the assignment, won't let me complete it though


#1

/*jshint multistr:true */

var text = "Dan word word word word word word word word word word Dan Dan"
var myName = "Dan"
var hits = []

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

That is valid, and does what the instructions say to do, but it won't let me pass.

Urgh... It want's i < i + myName.length in the for loop.


#2

Figured out what the issue was.


#3

Maybe you should listen then?


#4

The code I originally had works though, why should there only be one way of doing it?


#5

There are multiple ways to solve problems, of course, but you are meant to go by given instruction.