Answers for "while loop js"

7

while loop php

<?php
	$a = 0;
	while($a<=5){
    	echo $a."<br>";
      $a++;
    }
  ?>
Posted by: Guest on December-28-2019
30

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;
	}
}
Posted by: Guest on July-01-2019
1

example of while loop in javascript with array length

var soccerTeams = ['Barca','Madrid','Gunners','City','PSG']
var x=0;

while( x <= soccerTeams.length) {
  console.log(soccerTeams[x])
  x++;
}

======== output ===========
Barca
Madrid
Gunners
City
PSG
undefined
5
Posted by: Guest on February-12-2020
8

do while javascript

do {
  //whatever
} while (conditional);
Posted by: Guest on October-19-2020
4

do while loop in javascript

do {
  text += "The number is " + i;
  i++;
}
while (i < 10);
Posted by: Guest on November-25-2020
1

while loop js

let count = 0;
let max = 10;
while (count < max) {
	console.log(count)
    count = count + 1
}
Posted by: Guest on March-21-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language