जहाँ array के value में array हो उसे हम multiple dimensional ऐरे कहते हैं
var array_name[ [item_a_1, item_a_2, item_a_3 ], [item_b_1, item_b_2, item_b_3 ], ]
<script>
// singale Value print
var sal = [
["Rameh", 50, 450],
["Mahesh", 100, 900],
["Suresh", 150, 1350],
["Ganesh", 200, 1800],
]
document.write(sal[3][2]) //अगर हमें Ganesh का value 1800 print कराना हो तब
</script>
<script>
// Emp Salary With table Format
var sal = [
["Rameh", 50, 450],
["Mahesh", 100, 900],
["Suresh", 150, 1350],
["Ganesh", 200, 1800],
]
document.write("<table border='1', cellpadding='3', cellspacing='0'>");
for(var a = 0; a<=3; a++){
document.write("<tr>");
for(var b = 0; b<=2; b++){
document.write("<td>"+ sal[a][b]); document.write("</td>");
}
document.write("</tr>");
}
document.write("</table>");
</script>
Rameh | 50 | 450 |
Mahesh | 100 | 900 |
Suresh | 150 | 1350 |
Ganesh | 200 | 1800 |