Search text for your name


#1

I'm not ale to understand the use of +i in the second for loop

                    for(var j = i; j < (myName.length + i); j++) {
		hits.push(text[j]);

#2

the moment a hit is encountered:

if ( text[i] == "S")

i holds the index (for example 12) of the hit, then you set assign j a value of the index (j = i)(so j is now 12), then you use j to loop over your name. Lets say your name is 5 characters long, j will put the letters at index 12, 13, 14, 15 and 16 into your hits array. A good way to achieve this, is to by adding i (12) to your name.length (5). Make sense?