While Loops
How to write a while loop in JavaScript
while (condition) {
// code block to be executed
}Example
let i = 0;
while (i < 10) {
console.log(`The number is ${i}`);
i++;
}
console.log("The program is finished");Key Points
Last updated