Well, this is what I would do:
for (var j = 0; j < myName.length; j++)
Because I do not know what i means in your code, I would not add it in my for loop. I do not know why you put your i in there, so I will just explain using mine. Okay? Now... I'll explain:
First, you put a for loop. In the for loop, there are three parts, separated by semi colons:
- defining a variable
- showing a greater, less, or equal to with another variable/object
- what the variable should do until the statement(above) is true
What you do first is defining the variable. What is the variable? In this case, it is j. j is equal to 0 (defining it).
Now, you must show the variable and compare it with another variable/object that has already been declared and defined. In this case, j < myName.length is this part. It shows that j should be smaller than myName.length. The variable will go to the closest amount it can that will agree with this.
How? Why, showing how to do it (part 3)! This part is j++, in my code. This tells the variable j to go up one at a time until it can go closest to part 2, which is that j < myName.length.
This is what the for loop explains. I have explained it as best as I can, and I hope it helps you to understand it!