while loops js code example
Example 1: javascript while
var i=0;
while (i < 10) {
console.log(i);
i++;
}
//Alternatively, You could break out of a loop like so:
var i=0;
while(true){
i++;
if(i===3){
break;
}
}
Example 2: do while loop in javascript
do {
text += "The number is " + i;
i++;
}
while (i < 10);
Example 3: while loops js
while (10 > 1) {
console.log("HI");
}
Example 4: javascript while loop
while (i < 10) {
text += "The number is " + i;
i++;
}
Example 5: javascript while loop
while(condition) {
//whatever
}
Example 6: while loop js
let count = 0;
let max = 10;
while (count < max) {
console.log(count)
count = count + 1
}