Tells me wrong name


#1

var text = "Hey, how are you \
doing Max? My name is Max.";
var myName = 'Max';
var hits = [] ;
for
(var i=0;i if (text[i]==="M"){
for (var j=i;j < (myName.length+i); j++);
hits.push(text[j]);
}
}
if(hits.length === 0) {
console.log("Your name wasn't found!");
} else {
console.log(hits);
}

so it prints me [ '?', 'n', '.' ]


#2

You combined your if statement with your for statement. That's a syntax, and you have to make them separate. For example:

for(var i = 0; i < text.length; i++){
if(text[i] === "M"){
}
}

Also:
You put a semi colon here, which causes a syntax, and the semi colon makes your for loop useless and a problem.