Second for loop


hi i need to know in second loop why we make j < (myName.length + i) and not
j < (myName.length)
in other words why we use i in j < (myName.length + i)

for(var i=0 ;i < text.length ;i++) {
if(text[i]=== "s") {
for(var j = i;j < (myName.length + i ) ;j++) {


for(var j = i;j < (myName.length + i ) ;j++) {
 }; //<--- Take out the " ; " semi-colon and you should be good to go!


becaz if we dont mention " + i " it starts from zero ! instead to continue from the exact point that found name !
for eg its text = alala alasla lasasl alksak Hi saksjs Hi djskds skdjsd Hi
when the program find the first Hi ? when the cursor is on 28th index of text array!
so for print the first hi ,program must continue from i=28=j and continue till 28+2
and 2 is length of Hi ! Hi is the name in my example!
if you dont say name.lenght+i every time program find Hi start to counting from zero !
i am not native speaker i just wanted to help you i hope i could !