Answers for "while loop in javascript"

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
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
3

while loops js

while (10 > 1) {
  console.log("HI");
}
Posted by: Guest on December-01-2020
1

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);
Posted by: Guest on March-11-2021
0

while loop in javascript

const numbers = [3, 4, 8, 9, 2];
let number = 0;
while (number < numbers.length) {
    const getNumbers = numbers[number];
    console.log(getNumbers)
    number++
}
//Expected output:3 4 8 9 2
Posted by: Guest on September-16-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language