Sunday , September 8 2024

Analyze the following code: for (let a = 5; a > 2; a–) { console.log(a); }; Which statement can replace the for from the example?

Questions BankCategory: JavaScript Essentials 1Analyze the following code: for (let a = 5; a > 2; a–) { console.log(a); }; Which statement can replace the for from the example?
Analyze the following code:

for (let a = 5; a > 2; a--) {
    console.log(a);
};

Which statement can replace the for from the example?

  • let counter = 0;
    while (counter++ < 10) console.log(counter++);
  • let counter = 0;
    while (counter < 10) console.log(counter++);
  • let counter = 1;
    while (counter++ < 10) console.log(counter++);
  • let counter = 0;
    while (counter < 9) console.log(counter++);

More Questions: JavaScript Essentials 1 – JSE1: Final Test