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;
}
}
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;
}
}
do while loop in javascript
do {
text += "The number is " + i;
i++;
}
while (i < 10);
javascript do while
var result = '';
var i = 0;
do {
i += 1;
result += i + ' ';
}
while (i > 0 && i < 5);
// Despite i == 0 this will still loop as it starts off without the test
console.log(result);
while loop js
let count = 0;
let max = 10;
while (count < max) {
console.log(count)
count = count + 1
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us