while loop js

Solutions on MaxInterview for while loop js by the best coders in the world

showing results for - "while loop js"
Youna
14 Sep 2017
1<?php
2	$a = 0;
3	while($a<=5){
4    	echo $a."<br>";
5      $a++;
6    }
7  ?>
Benjamin
29 Feb 2020
1var i=0;
2while (i < 10) {
3	console.log(i);
4	i++;
5}
6//Alternatively, You could  break out of a loop like so:
7var i=0;
8while(true){
9	i++;
10	if(i===3){
11		break;
12	}
13}
Alan
27 Oct 2019
1var soccerTeams = ['Barca','Madrid','Gunners','City','PSG']
2var x=0;
3
4while( x <= soccerTeams.length) {
5  console.log(soccerTeams[x])
6  x++;
7}
8
9======== output ===========
10Barca
11Madrid
12Gunners
13City
14PSG
15undefined
165
Ninon
03 May 2017
1do {
2  //whatever
3} while (conditional);
Liam
21 Feb 2020
1do {
2  text += "The number is " + i;
3  i++;
4}
5while (i < 10);
Tomas
05 Jul 2019
1let count = 0;
2let max = 10;
3while (count < max) {
4	console.log(count)
5    count = count + 1
6}
similar questions
queries leading to this page
while loop js