
while Loop – Checks the condition **before** each iteration. Repeats an unknown number of times until the condition becomes false.
๐ Syntax
while (condition) {
// code executes while condition is true
}
๐งช Example
let n = 3;
while (n > 0) {
console.log(n);
n--;
}
Comments
Post a Comment