The correct answer is I and II.
Here are the reasons:
I. The for loop uses commas instead of semicolons: In a for loop in JavaScript, the three components (initialization, condition, and increment) must be separated by semicolons (;
), not commas (,
).
II. It should say i++
instead of i + 1
: The incrementer part of the for loop should ideally use i++
(or i += 1
, or i = i + 1
), but i + 1
by itself does not update the value of i
.
Therefore, both points indicate issues with the for loop syntax and logic. The corrected loop should look like this:
for (let i = 0; i < 10; i++) {
move();
}