What am i doing wrong?


/*jshint multistr:true*/

var text = "random stuff that I Ben don't want to have to do\ at all Ben I really think that this random text is boring";

var myName = "Ben";

var hits = [];

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

What am I doing wrong? I have no idea. Somebody help me


I think the second for never gets executed. If i = 10, then j = 10, but 10 is not bigger than 13(10+3). Try that first, after that I see other issues.



">" should be "<". Typos, can be so hard to catch.


The code you have below that for line looks wrong to me too.
the hits = [] line will empty the hits array.
You're pushing from myName to hits, and I think we're supposed to push from the 'text' array.
hits[0]; doesn't do anything.

for (var j = i; (j < i + myName.length); j++){