Loop JavaScript através da matriz
var colors = ["red","blue","green"];
colors.forEach(function(color) {
console.log(color);
});
Gifted Gerenuk
var colors = ["red","blue","green"];
colors.forEach(function(color) {
console.log(color);
});
var i=0;
for (i=0;i<=6;i++){
document.write("Le nombre est : " + i);
document.write("<br />");
}
# For loops in Dip
for i = 0 to 5 then print(i)
var test = 0;
type 1;
while (test < 10) {
console.log(test)
test = test++
}
/* while (condition) {
our code
} */
return(
0
1
2
3
4
5
6
7
8
9) to the from (instant) * 'in console'
type 2;
for (var n = 0;n < 10; n++) {
console.log(n)
}
//note separate codes in for loops with ";"
/* for (Initial value before starting the loop;loop Condition;value after ending loop) {
our code
} */
return(
0
1
2
3
4
5
6
7
8
9) to the from (instant) * 'in console'
for(let i = 1; i <= 5; i++){
if (i % 2 !== 0) console.log("Number", i);
}
let i = 2;
while (i <= 6){
console.log("Number", i);
i++
}
let j = 1;
do {
console.log("Number", j);
j++;
} while(j <= 5)
for ([initialExpression]; [conditionExpression]; [incrementExpression])
statement