ab2
0
Q:

js while

let i = 0;
while (i < 3) {
	console.log(i)
    i++;
} 
/*
Console:
0
1
2
*/
3
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;
	}
}
16
while (i < 10) {
  text += "The number is " + i;
  i++;
}
8
while(condition) {
  //whatever
}
4


while (condition) {

      // code block to be executed

 } 
0

New to Communities?

Join the community