Knowledge Walls
John Peter
Pune, Maharashtra, India
How to use foreach loop in javascript with Example
2704 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 />");
}
Demo & Output 
Best Lessons of "Good Javascript Examples"
Top lessons which are viewed more times.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details