I need your help for the second "for" loop


#1

Ok so I kept trying to figure this out but I just gave up, not a good idea but I had to ask y'all

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

Error code: Oops, try again. There was a problem with your syntax.

/*jshint multistr:true */
var text = "enrhgjasjdnfjdksaifj hanjf ajkdfhkshdfkas fshdf hdkasewoifjvnxc khuhf sodif woqpr  fjdsj Ethan sfhdjs whejrx xd fjehw sndjkfla nsj dfkj fhdjskj fhskajsh whejkrj fhdsja shjkd";

var myName = "Ethan";

var hits = [];

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

#2

You are missing a closing } :slight_smile: .


#3

Im having a problem where the code displays the place value of my name, and saves them to the array, but I can't get it to display the data it finds at the place value. Help pleasee.


#4

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