5/7 need help


#1
/*jshint multistr:true */
text = "Joeja JKLoie JOKIEJo Mitchell KLJOIE JIEJ jIEJ Mitchell Hudson Heosj"
var myName = "Mitchell"
var hits = []
for (var i = 0; i < text.length; i++){
    if (text[0] === "M") {
        for (var j = i; j < (i + myName.length); j++) {
            hits.push(text[j])
        };
    };
}

pushes this error:
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.

what is wrong and could someone please help


#2

Replace the "0" in your for loop with "i".

-----------------------------------------------------------------

Why?

Well, that connects to another question:

What's the use of this then?

This code is used to say that when "i" finds the first letter of "M" in the text, it looks at the rest of the word and finds it.