HI I struck in this loop please help me


#1

var text = "venu madhav bhala bhala";
var myName = "venu";
var hits = [];

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


#2

in your second for loop:

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

you increase i (i++) at the end, why? I would increase v (v++), you use v to loop over the myName variable