Still not understanding why j< i + myname.length


#1

I'm sorry, I was also confused on why j < i + name.length...i understood most of your explanation except for that part. Is it basically like saying. i is the first letter (in my case M) and the total letters in the name is 4 which is myName.length + i = 5 thereore j < 5 ??

I'm sorry i've just got so confused about this, i think i've made it a bigger problem than it really is haha


#2

there are plenty of explanations on the forum. look at the rest of your for loop:

for(j = i;

you set j equal to i, why? Because i contains the index of M. lets say the index of M is 20. then your name is at 20, 21,22 and 23. So j (which we just set to 20) smaller then i (20) + myName.length (4) is 24. So now, j will loop from 20 till 24 (24 not included), pushing each letter of your name into the array


#3

I had the same question too, your explanation was perfect and now I understand it.