JavaScript: Loops
Loops I. What is a loop? A loop repeats a set of instructions until a specified condition, called a stopping condition, is reached. II. For loop A for loop contains three expressions separated by a semi-colon inside the parentheses: an initialization starts the loop. a stopping condition. If the condition evaluates to true, the code block will run, and if it evaluates to false the code will stop. an iteration statement updates the iterator variable on each loop. For example for (let i = 0 ; i < 3 ; i++) { console.log(i); } // Output: 0 ; 1 ; 2 ; In the code block above: The initialization is let i = 0 , so the loop will start counting at 0. The stopping condition is i < 3 , so the loop will run as long as i is less than 4. The iteration statement is i++ . After each loop, the count value will increase by 1. For the first iteration, the counter will equal 0. For the second iteration, the counter will equal 1, and so on. The code block...