You understand what code will search for. So, lets start.First for loop will start at text[0], first position, and go until comes to an end. In every iteration, it will compare current position, text[i], with first string of your name, in my case with "I". If it finds that text[i] === myName[0], it goes into second while loop.Second while loop will start at current "i" position (notice j = i), and use "j" as its counter. It will end when it reaches current position index + length of your name, in my case, lets say that "I" was found on position 10, and myName.length = 4, so it will run from 10th till 13th index (because we use j <, it will terminate one position before current index + name length).It will just push number of characters in your name into variable hits and that's it. Now this wont work perfectly correctly, because if I had var text = "Ignore this is wrong, Igor"; inside hits instead of just hits = ['I', 'g', 'o', 'r'] we would have hits = ['I', 'g', 'n', 'o', 'I', 'g', 'o', 'r'] (I didn't put this in code so I can bold this part that wouldn't be actual solution, but would be included).

Let me know if I can make solution simpler or you have more questions.