Your second "for" loop not working


#1



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


It's constantly saying "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."


var text = "Cutie Ervin Ervin Sports Ervin Word Ervin Pretending \ To Have Actual Words Ervin";
var myName = "Ervin";
var hits = [];
for (var i = 0; i > text.length; i++) {
    if(text[i] === 'E') {
for (var j = i; j < (myName.length + i); j++) {
            hits.push("Ervin");
        }
    }
};


#2

@incredibuddy,

for ([initialization]; [condition]; [final-expression]) {
   statement
}

In your 1st FOR-loop
you _initialize i with the Value 0 zero
then in your condition you test if i is =greater than= text.length
and that is NOT going to happen !!!!!!

Reference

google search
== the Book ==
javascript [your question] site:developer.mozilla.org

== discussions / opinions ==
javascript [your question] site:stackoverflow.com

== guidance ==
www.crockford.com
http://javascript.crockford.com/code.html <---JavaScript code-convention
http://javascript.crockford.com/survey.html
https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript
www.developer.mozilla.org/en-US/docs/Web/JavaScript/Guide


#3

Wow, thanks. I feel kinda dumb for not seeing that.