5. Your second loop, I dont get it really lol, Oops, try again. Make sure you're pushing letters to the hits array!


#1

https://www.codecademy.com/courses/javascript-beginner-en-XEDZA/0/5?curriculum_id=506324b3a7dffd00020bf661

Oops, try again. Make sure you're pushing letters to the hits array!

var text = "Random is really amazing at programming, Random learned how to do all of this in just a couple of days. Do you want to be like Random?";
var myName = "Random";
var hits = [];

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

#2

The kickr.

if (text[i] === "R") {

We never write a semi-colon before an opening brace. There are none in an if-else if-else statement construct.


#3

When I remove it, I get the following message: 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.


#4

remove the semicolon after the condition in your first if statement. With the semicolon, you ended the for loop early and nothing in the body of the loop get executed which therefore the letters do not get pushed inside the array. hope that helps