- The for Loop 4:52
- Create a for Loop 1 objective
- Dynamically Display HTML with a Loop 6:52
- Exit a Loop
- Terminate a Loop 1 objective
- The Refactor Challenge 3:00
- The Refactor Challenge – One Solution 3:05
- The Refactor Challenge – Duplicate Code 6:01
- Review for Loops and Exiting Loops 6 questions
- Refactor Code with a Loop 1 objective
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 = 0; i < 5; i += 2) { console.log(`The counter is now: ${i}`); }
-
B
for (let i = 0; i < 5; i++) { console.log(`The counter is now: ${i}`); }
-
C
for (let counter = 0; counter < 10; counter++) { console.log(`The counter is now: ${counter}`); }
-
D
for (let i = 1; i < 5; i++) { console.log(`The counter is now: ${i}`); }