Javascript examples for Array Operation:Associative Array
Generate an array of dictionaries with a For loop and output its value
<html> <head></head> <body> <p id="demo"></p> <script> var arr=[];//from ww w . j a va 2 s . c o m var i; var text=""; for(i=0;i<10;i++){ arr.push({firstName : "John"}) } for(i=0;i<10;i++){ text=text+arr[i].firstName+'<br />' } document.getElementById("demo").innerHTML = text; </script> </body> </html>