Not understanding "j < (myName.length + i" part of for loop


#1

I'm not understanding the concept behind "j < (myName.length + i" part of the for loop.

What I do understand is that "myName.length" is counting the number of characters in "myName" variable, correct? I don't get why it would add "i" ... then why would "j" be less than all of "myName.length + i"?

Below is a sample of the code I have so far:

/*jshint multistr:true */

var text = "Hi my name is Nina. Again my name is Nina";

var myName = "Nina";
var hits = [];

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


#2

writing such an explanation takes a lot of time, did you check other answers? (link1, link2)

the moment your if condition is true, i will hold the index of the first letter of your name, and as long j < i + myName.length is true, j will contain all the indexes for your name in the second for loop. so text[j] will contain the letters