Help please


#1

var text = "Hey ther what is max my name is max ok yes thats fine";
var myName = "max";
var hits = [];
for(var i = 0; i < text.length; i++) {
if( text[i] === 'm') {
for(var j = i; j < i + myName.length; j++) {
hits.push(text[j]);
}
}
};
if(hits === 0) {
console.log("Your name wasn't found!");
}
esle {
console.log(hits);
}

please tell me what I did wrong


#2

Hi this part

if(hits === 0)

Instead of hits try to put hits.length


#3

i tried that
and its not it


#4

what error do you get?


#5

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


#6

Here

esle {
console.log(hits);
}

You wrote esle instead of else


#7

haha thats right thank you

but ive got another problem in the outcome I get this: [ 'm', 'a', 'x', 'm', 'y', ' ', 'm', 'e', ' ', 'm', 'a', 'x' ]


#8

Hi you should wrote you name with the leltter uppercase "M" in all your code inside the var text and the the variable name .