5. your second for loop


#1


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


i really dont understand this! please help thanks!


/*jshint multistr:true */
var text ="Beata will, I know I am a righteous man, of my virtue I am justly Proud.";
var myName = "will";
var hits = [];

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

}
    
    }    
}


#2

3 x '{'
4 x '}'

One } is unwanted :slight_smile: Delete it and your code should work.


#3

awesome! thanks works a treat!! :wink:


#4

You're very welcome :slight_smile:


#5

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