Looping in Javascript
Loops in Javascript are really useful. Generally, they are used with arrays. While loops will run the code inside of them while the boolean expession is true. Once the experssion is false the loop will end. The proper syntax for a while loop is shown below.
while(boolean expression){ //code that repeats until boolean is false }
Another kind of loop is the for loop. This type of loop uses a counter with a boolean expression. Once the boolean expression evaluates to false the loop ends. The proper syntax for a for loop is shown below.
for(set up counter; boolean expression on counter; increment the counter){ // this code will repeat until the boolean expression on the counter evaluates to false }