Ajax-loader-large-white
Introduction to 'While' Loops in JS
While we're at it

Great work with for loops! We know you know your stuff, but just as a reminder, for loop syntax looks like this:

for(var i = start; i < end; i++){
    // Do something
}

Where "start" is where our counter variable (usually i) starts, and "end" is the condition that ends the loop.

But what if you don't know ahead of time what your counter will be or how many times you'll have to go through the loop? Enter while.

Instructions

Check out the while loop in the editor. Can you guess what it will do? Hit Save & Submit Code when you think you know! (Hit Save & Submit Code a few times to see the different possible outcomes.)

script.js