ReferenceError: hit is not defined


#1

var text = "Hey, how are you\
doing? My name is Juliana.";
var myName = "Juliana";
var hits = [];

for (var i =0; i if (text[i]===myName[0]){
for (var j=i; j hits.push(text[j]);
}
}
}
if (hit.length === 0){
console.log("Your name wasn't founded");
} else console.log(hits);

I can't find what's wrong with my code :frowning:


#2

@boardwhiz31443,

Have a close look at

var hits = [];

hit.length