-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMultidemensional-array.js
More file actions
35 lines (31 loc) · 1018 Bytes
/
Multidemensional-array.js
File metadata and controls
35 lines (31 loc) · 1018 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// array inside another array is called multidimensional array.
// simple table.
let ary = [
["Muhammad Shakir", "BSSE", "6th", "Morning"],
["Muhammad Haris", "BSSE", "6th", "Morning"],
["Wajid Hussain", "BSSE", "6th", "Morning"]
]
document.write("<table border='1px' cellspacing='0'>");
for (let a = 0; a < 4; a++) {
document.write("<tr>")
for (let b = 0; b < 4; b++) {
document.write("<td>" + ary[a][b] + "</td>");
document.write("</tr>")
}
}
document.write("</table>")
// proper table.
var ary = [
["Muhammad Shakir", "Front-end Developer"],
["Rehan Sattar", "Full stack developer"],
["Saad Pasta", "Software engineer"],
]
document.write("<table border='1px' cellspacing='0'>")
for(let a = 0; a < ary.length; a++){
document.write("<tr>")
for(let b = 0; b < ary[a].length; b++){
document.write("<td>" + ary[a][b] + "</td>")
}
document.write("</tr>")
}
document.write("</table>")