Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

question: 10 what is wrong with this for loop? for (var i = 0, i < 10, …

Question

question: 10
what is wrong with this for loop?
for (var i = 0, i < 10, i + 1) {
move();
}

  1. the for loop uses commas instead of semicolons
  2. it should say i++ instead of i + 1

i
ii
i and ii
the for loop is correct

Explanation:

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.

Answer:

C. I and II