Example: Iteration using while

Click on the Run button and notice the number of iterations, based on the length of the string.

Now change myString to the empty string. Before clicking on the Run button again, try to figure out what will result from each of the loops.

Note:

Hints:

  • undefined
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
var myString = "abcdefghi";
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX