JavaScript Loops
Often in programming, we need to carry out similar instructions a number of different times. Loops help reduce redundant code and let you quickly offload repetitive tasks to the computer. In JavaScript there are several types of loops. In this lesson we are going to examine while, do while, and for loops. While and Do While loops As their names suggest, while and do while loops carry out a number of tasks ‘while’ a certain condition is true. Take for example the need to display a series of numbers each incrementing by 1 until it we reach a certain limit (10). This could be carried out by writing the following code: ...