Loop JavaScript
for ([initialExpression]; [conditionExpression]; [incrementExpression])
statement
Larry Adah
for ([initialExpression]; [conditionExpression]; [incrementExpression])
statement
for (var i = 0; i < 4; i++) {
}
for(var i = 0; i < 6; i++) {
//This is a very simple loop template
}
var list = [{a:1,b:2}, {a:3,b:5}, {a:8,b:2}, {a:4,b:1}, {a:0,b:8}];
for (var i = list.length - 1, item; item = list[i]; i--) {
console.log("Looping: index ", i, "item", item);
}
######### ES6 Update ################
for (let item of list) {
console.log("Looping: index ", "Sorry!!!", "item" + item);
}
let num = 1
for (let i = 0; i <= 10; i++) {
document.write(num++);
}
for (var i, i = 0; i < 10 ; i++) {
//do something
}