Can someone please help, I have checked this code over and over


Error Code I'm getting 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."

/*jshint multistr:true */
var text = "this is the string that I'm using, Michael, to test\
if it can detect your name, Michael";

var myName = "Michael";

var hits = [];

for (var i = 0; i < text.length; i++) {
    if (text[i] === "M") {
       for (var j = i; j < (myName.length + 1); j++) {


nevermind I was adding "1" instead of "i" to the second for statement!!! UGH stupid similar looking characters!


Hi @arcjumper73595,

Other than that, just want to point out,


is not needed in the exercise.



yeah, I only added that in there during my troubleshooting phase because I saw others had it lol
Obviously it didn't help :sweat_smile:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.