How to use foreach loop in javascript with Example
2669 Views
Define for..in loop?
for..in loop is used to iterate object in javascript.
for (var index in object){
enumeration method loop
}
Example
var osList = new Array();
osList.push("Android");
osList.push("Windows");
osList.push("Linux");
osList.push("Mac");
for (var index in osList){
document.write("osList["+index+"] : "+osList[index]+"<br />");
}