What are the steps of a 'for' loop?
for(var i = 0; i < 3; i++) {
console.log(i);
}
Drag each item to put the steps in the correct order:
- BEGIN
- END
-
- A. check condition: 0 is less than 3, so begin the code in the loop
- B. check condition: 1 is less than 3, so begin the code in the loop
- C. check condition: 2 is less than 3, so begin the code in the loop
- D. check condition: 3 is NOT less than 3, so for loop ends
- E. declare a variable called i and set it equal to 0
- F. log 0 to the console
- G. log 1 to the console
- H. log 2 to the console
- I. increase i from 0 to 1
- J. increase i from 1 to 2
- K. increase i from 2 to 3