I don't understand!


#1

text = "Hey, how are u? \
My name is Luis, do u know me? \
Everybody calls me Luis, so \
i'm sure u know my name 'Luis' \
Nice to meet you, my friend \
Next time call me Luis, Ok?";

var myName = "Luis";

var hits = [];

for( var i = 0; i < text.length; i++) {
if( text[i] === "L") {
for( var j = i; j < i + myName.length; j++) {
hits.push(text[j]);
}
}
}
if( hits.push(text[j]) != myName) {
console.log("Your name wasn't found!");
}
else {
console.log(hits);
}

I passed this lesson but it didn't print out what i wanted it to print:
In the text, I had to look for my name by using the 'for' loops method and as u can see in the text, my name 'Luis' is there but when i printed it out it said it didn't found my name in the text.


#2

Hi here

Instead of

if( hits.push(text[j]) != myName)

Try it like that

if( hits.length === 0)