Tutorial says I completed my objective, but code doesn't work


#1

Tutorial says I've completed my lesson, yet the code doesn't actually find my name. It merely outputs "[]". Where did I go wrong? I thought I followed the instructions exactly.

/*jshint multistr:true */
var text = "Rob would like to know \ where in this sentence the \ word 'Rob' is hiding.";
var myName = "Rob";
var hits = [];

for (var i = 0; i < text.length; i++) {
if (text[i] === "R") {
for (var j = i; j < i + myName.length; j++) {
hits.push(j);
};
};

};

if (hits.length = 0) {
console.log("Your name wasn't found!")
} else {
console.log(hits);
}

This is what I've written. It is allowing me to move onto the next lesson with this, despite the code actually not doing what it was supposed to do.


#2

Hi inside your last if statement try to put hits.lenght == 0 with two ==