6/7 No letters logged to hits (still passing)


#1

Hi everyone,
with the code below, I passed the lesson 6/7 "Log it!" although there were no letters logged to hits. Could anyone explain, what my mistake was.

/*jshint multistr:true */
var text = "bla bla bla sixclaw bla sixclaw.";
var myName = "sixclaw";
var hits = [];
for (var i = 0; i < text.length; i++) {
    if (text[i] === myName[0]) {
        for (var j = i; j < i + myName.length; j+= 1) {
        hits.push(text[j]);
        }
    }
}
if (hits.length = 0) {
console.log("Your name wasn't found!");
}
else {
    console.log(hits[j]);
}

Thanks in advance


#2

When I am submitting my code

undefined

is printed to the console.