Javascript Looping | Learn Web designing with ME

1
22
Javascript Looping

Javascript Looping | Learn Web designing with ME

Here is the Looping Coding

var alist = [
“a”,
“b”,
“c”,
“d”
]

var blist = [
“a1”,
“b1”,
“c1”,
“d1”
]

for (var i=0; i < alist.length; i++) {
console.log(i);
}

for (var i=0; i < alist.length; i++) {
console.log(alist[i], i);
}

for (var i=0; i < alist.length; i++) {
console.log(alist[i] + “1”);
}

for (var i=0; i < alist.length; i++) {
alist[i] = alist[i] + “1”;
}

var a = 0;
while (a < 10) {
console.log(a);
a++;
}

var a = 10;
while (a > 10) {
console.log(“while loop”, a);
a–;
}

var a=10;
do {
console.log(“do while loop”, a);
a–;
} while (a > 10);

alist.forEach(function(a, i) {
console.log(a, i);
})

function jit(a, i) {
console.log(a, i);
}

alist.forEach(jit);
blist.forEach(jit);

Subscribe to Tech Guru Manjit

Network Security

Ring Topology Configuration

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here