Using for as the while Loop in JavaScript: an Example