जहाँ array के अंदर Object value हो उसे हम Array Object Value कहते हैं
var array_name[ object_name {property_a_1:value, property_a_2:value, property_a_3:value }, object_name {property_b_1:value, property_b_2:value, property_b_3:value }, ]
<script>
// (Prongarm 1
var a =[
{name:"Rahul", age:20},
{name:"Ramesh", age:30},
{name:"Sruresh", age:40},
]
for(var b = 0; b<3; b++){
document.write(a[b].name+" "+a[b].age+"<br>")
}
</script>
<script>
// Table Format
var a =[
{name:"Rahul", age:20},
{name:"Ramesh", age:30},
{name:"Sruresh", age:40},
]
document.write(
"<table cellspacing='0' cellpadding='10' border='1'>")
document.write("<tr>")
document.write("<td>Name</td> <td>Age</td>");
document.write("</tr>");
for(var b = 0; b<3; b++){
document.write("<tr>")
document.write("<td>"+a[b].name+"</td><td>"+a[b].age+"</td>");
document.write("</tr>")
}
document.write("</table>")
</script>
Name | Age |
Rahul | 20 |
Ramesh | 30 |
Sruresh | 40 |