While Loop

let count = 1;
while (count <= 5) {
  console.log("Count: " + count);
  count++;
}

Explanation:

  • while runs as long as the condition is true.
  • Prints Count: 1 to Count: 5.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *