Your second for loop Please Help


#1

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

unexpected string


/*jshint multistr:true */

var text = "Stewart containing some text for Stewart written and developed by Stewart";

var myName = "Stewart";

var hits = [];

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

if(hits.length === 0){
    console.log"Your name wasn't found!");
}
else {
    console.log(hits);
}


#2

You need to add ( before specifying the string in this line:

console.log"Your name wasn't found!");

#3

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