QUESTION IMAGE
Question
question: 10
what is wrong with this for loop?
for (var i = 0, i < 10, i + 1) {
move();
}
- the for loop uses commas instead of semicolons
- it should say i++ instead of i + 1
i
ii
i and ii
the for loop is correct
Brief Explanations
In a JavaScript for loop, the three parts (initialization, condition, increment) are separated by semicolons, not commas. Also, the increment should be i++ (or other valid increment - like i += 1 etc.) instead of i + 1 which is just an expression and not an increment statement.
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
C. I and II