It should work fine but doesnt


#1



/*jshint multistr:true */
var text = "asdasdwd asdw dan wda sdwd awdwawdw awd dan dwadawuhjr guy \
adsjbnuwbd kmawn dan dwadwdadwadw dan!";
var myName = "dan";
var hits = [];
for (var i = 0; i < text.length; i++) {
if(text[i] === "D") {
for (var j = i; j < (myName.length + i); j++) {
hits.push(text[j]);
}
}
}


Oops, try again.It looks like your second 'for' loop isn't pushing values to the hits array.


I have no clue why this isnt working. As checked with other posts it should work fine!


Fixed
Fixed
#2



Fixed, the  if(text[i] === "D") is case sensitive!

Continuing the discussion from It should work fine but doesnt: