Don't get why it works


so i passed the lesson, after much hardship, and i have realized it's probably because I don't get why it sees your name.

for(var i = 0; i < text.length; i++) {
	if (text[i] === "E") {
		// If we find it, add characters up to
		// the length of my name to the array
		for(var j = i; j < (myName.length + i); j++) {

it never says anything about searching the text, the closest it gets is to say stop when ii realy want to understand but i dont !(


Give us the FULL code you are using inclusive the text variable


In truth, it does not "see" our name, and only matches the first letter. This is explained in the lesson text at some point.

The exercise builds an array of single letters. Once the first letter is found, the inner loop starting index is set to the current position, and that and the next myName.length -1 characters are pushed to the array.


ok, then what tells it to find that part of the text


In the outer loop, text[i] is the letter in the current index position, i. We can use this number as the starting index of the inner loop, where j = i to begin with.


but what makes it scan, it just has beginning and end points and no more info, except how much to advance by


it 'scans' one letter at a time (iteration).