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}
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
1let count = 0;
2let max = 10;
3while (count < max) {
4 console.log(count)
5 count = count + 1
6}