6/7 could someone please point out where i have gone wrong...my output is all messed up; it mixes my name with other letters


#1

/*jshint multistr:true */
var text = "Bacon kevin dolor amet cupim pancetta porchetta,\ meatloaf shank short ribs chuck tail. Sirloin picanha pig, kevin\ prosciutto tail venison leberkas alcatra pastrami meatloaf jowl\ andouille capicola. Pastrami kevin capicola salami ribeye sirloin";

var myName = "kevin";

var hits = [];

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


#2

:neutral_face: Where did you get the "k" from? In place of "k", you're supposed to do

if(text[i] === myName[0])


#4

"k" is the first letter/index of myName. which is the same as myName[0]. That i get, but even after running the code with if(text[i] === myName[0]), i still get the same results, but when i capitalize my name in the text and myName variables (from kevin to Kevin) the code works as it should.


#5

So... problem solved?