5/7: could someone tell me whats wrong?, i can't for the life of me figure this out


#1

var text = "alex alex alex alex";

var myName = "alex";

var hits = [];

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


#2

In your "if" statement, you incorrectly put these: [].
Instead of:

if (text[i === "a"])

you have to do:

if(text[i] === "a")

Hope it helped! :smiley: