5. Your Second "for" Loop


#1


I have thought all the things I could, but I still can't find out what is wrong.
Please help me !

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

Replace this line with your code. 
/*jshint multistr:true */

var text = "Yerim";
var myName = "Yerim";
var hits = [];


for( var i = 0; i <= text.length; i++)
if (text[i]==='Y') {
    for (var j = i; j < i + Myname.length; j++) {
        hits.push(text[j]);
    };
};
}
console.log(hits);


#2

this line:

for( var i = 0; i <= text.length; i++)

a { is missing at the end to mark the start of the for loop.

and in the second for loop, take a close look at how you spelled myName


#3

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