- What is looping control flow allowing us to do?
allows us to repeat the same process over and over with less work - Describe what “loops” do in your own words.
while a certain condition evaluates to true, the loop of code repeats itself - What is the difference between while and do-loops?
do loops always executes its body at least one, the condition comes after the statement. while loops may not execute once if the initial condition is not met
DO:
let number = 0;
while (number <= 12) {
console.log(number);
number = number + 2;
}
// → 0
// → 2
// … etcetera
WHILE:
let yourName;
do {
yourName = prompt(“Who are you?”);
} while (!yourName);
console.log(yourName);
- What is indentation?
your IDE will automatically make spaces with each new block of code. This is not necessary but helps to make the blocks stand out.