“tun, während JavaScript” Code-Antworten

JavaScript während

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;
	}
}
Grepper

während Loop JavaScript

while (condition) {
	// code
}

// example
let index = 0;

while (index < 10) {
    // code
    index++;
}

//  enjoy :)
Odd Octopus

während vs während JavaScript tun

// while vs do...while loops

/* while loops: check condition first. If true, execute code. */
let i = 0; 
while (i < 5) {
  console.log(i); // 0 1 2 3 4
   i += 1;
}

/* do-while loops: execute code at least once even if condition is false. 
Then check condition. If true, continue executing code. */
let j = 6;
do {
  console.log(j); // 6
    j += 1;
} while (j < 5);
Intra

tun, während JavaScript

do {
  //whatever
} while (conditional);
slohobo

tun, während JavaScript

let arr = ['jan', 'feb', 'mar', 'apr', 'may'], i = 0;
// do something at least 1 time even if the condition is false
do{
	console.log(arr[i]);
	i++;
}while(arr.includes('dec'));
// output: jan 
Felipe Lullio

tun, während JavaScript

var i = 0;
do {
  text += "The number is " + i;
  i++;
}
while (i < 5);
Encouraging Eagle

Ähnliche Antworten wie “tun, während JavaScript”

Fragen ähnlich wie “tun, während JavaScript”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen