Want help in this. How to use for loop to exit?


#1


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

Oops, try again. Careful: your second 'for' loop should stop when it reaches its current point in the string + myName.length.

/*jshint multistr:true */
var text= "Hey, i am Emily Emily Emily.";
var myName= "Emily";
var hits= [];
for(var i=0; i<text.length;i++){
    if(text[i] === 'E')
    {for(var j=0;j<myName.length;j++ ){
    }
        
        }
    
    }


#2

@shubhamdhariyal,
Maybe if you read
https://discuss.codecademy.com/t/i-passed-this-but-i-just-need-someone-to-explain-the-second-for-loop/30895/2?u=leonhard.wettengmx.n
you will understand the Oops-message


#3

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