5. Your second "for" loop


#1



Whats wrong with my code its telling me to push letters to my arrays.  Please help.

/*jshint multistr:true */
var text = "Hey, how are you \
doing? My name is Dylan";
var myName = "Dylan";
var hits = [];

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


#2

The hits.push should be myName not text[j]

Yours:

hits.push(text[j])

Mine :slight_smile::

hits.push("Dylan")


#3

Thank you this really helped me out!


#4

I had the same issue. From what the instructions said I think it is correct. "If we find the first letter of the user's name we will add the number of letters of the user's name". It doesn't say it will add the user's name. Ex: "My name is Pineapple I love Picking them"

hits[Pineapple, Picking t] right?