It says I did it, but I didn't


It says I did everything correctly, but it just logs to the console every single letter, which must have been passed to hits. I don't understand how the system even works to debug it. Can someone help out and explain what I did wrong? Here's my code:

/*jshint multistr:true */

var text = "aldnav sakjnf Eric \
Ljfal gbjaj Eric afjsalfj \
Eric ahasthpoa";

var myName = "Eric";
var hits = [];

for (var i = 0; i < text.length; i++) {
    if (text[i] === "E") {
        for (var n = 1; n < i + myName.length; n++) {

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


That's probably what it is supposed to do, isn't it?


No. It's only supposed to log the letters to hits that are the letters of my name.


in your for loop that is inside of your other for look and if statement you wrote
" for (var n = 1; ... "
and it needs to be " for (var n=i ... "


thanks for providing the solution to this