Your second "for" loop isn't pushing values to the hits array


#1

Hey guys I don't know why my code isn't working; thanks in advance!

var text = "Hello, my name is Lina. What's yours? I hear that you like tomatoes."

var myName = "Lina"

var hits = []

for (i=0; iif (text[i] === "L") {
for (j = i; j< (myName.length + i); i++) {
hits.push(text[j]);
}
}
};
console.log(hits);


#2

solved!

var text = "Hello, my name is Lina"
var myName="Lina"
var hits=[]
for (var i=0; i if(text[i]==="L") {
for (var j = i; j<(i + myName.length); j++) {
hits.push(text[j]);
}
}
}