Nalini1998 / Project_Public

MIT License
2 stars 0 forks source link

What problem is caused by this code block? #548

Closed Nalini1998 closed 1 year ago

Nalini1998 commented 1 year ago

What problem is caused by this code block?

for (let i = 10; i > 0; i++) {
  console.log(i);
};

A. You can’t run a loop without an array.

B. The code won’t run because the stop condition is less than the start condition.

C. i = 10 and i > 0 should be switched.

D. The code will loop forever because i will always be greater than 0.

Nalini1998 commented 1 year ago

I chose D. The code will loop forever because i will always be greater than 0.