6 Log it! Why my console output shows []


#1



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


The exercise gives me the green light, and way to go! but I don't understand why on my output console it only shows [ ]?
If I understand this exercise, it should show me all the letter of my name.
is it because of my var hits = [ ]?

What should I do?
Please help.
Thanks



/*jshint multistr:true */
var text = "blah blah Natacha, blah blah yes no \
can go to the moon, and run a marathon, Natacha is \
a great person, she love to go skiing, blah blah blah";

var myName = "Natacha";

var hits = [];

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


#2

Hi here

if (hits.length = 0)

you should put === instead of =


#3

Thank you, it works, I can now see all my letters on the console.
Thanks again.