JavaScript - 19

JavaScript - 19: While Loops

Use a while loop to print numbers from 1 to 10. Then create another while loop that doubles a number until it exceeds 100.

✦ JavaScript Editor
▶ Live Output

👀 Show Solution
let i = 1;
while (i <= 10) {
  console.log("Count:", i);
  i++;
}

let num = 2;
while (num <= 100) {
  console.log("Doubling:", num);
  num = num * 2;
}