5/7, I have a good idear


#1



the first can through
but two can't throght,and i thing two is good than one;

<one>
var text="Hey, how are you \
doing? My name is Emily.";
var myName="Emily";
var hits=[];
for(var i=0;i<text.length;i++){
    if(text[i]==="E"){
        for(var j=i;j<text.length+myName.length;j++){
            hits.push(text[j])
        }
    }
}


<two>
var text="Hey, how are you \
doing? My name is Emily.";
var myName="Emily";
var hits=[];
for(var i=0;i<text.length;i++){
    if(text[i]==="E"){
        for(var j=0;j<myName.length;j++){
            hits.push(text[j+i])
        }
    }
}


#2

Did you mean to write,

    j < i + myName.length;

?


#3

I'm sorry , I thought was wrong . You are right! thank you:blush::blush: