Well done!
You have completed Review for Loops and Exiting Loops !
Quiz Question 1 of 6
Which of the code blocks below works the same as the following while
statement:
let counter = 0;
while (counter < 5) {
console.log(`The counter is now: ${counter}`);
counter++;
}
Choose the correct answer below:
-
A
for (let i = 1; i < 5; i++) { console.log(`The counter is now: ${i}`); }
-
B
for (let counter = 0; counter < 10; counter++) { console.log(`The counter is now: ${counter}`); }
-
C
for (let i = 0; i < 5; i++) { console.log(`The counter is now: ${i}`); }
-
D
for (let i = 0; i < 5; i += 2) { console.log(`The counter is now: ${i}`); }