Having trouble displaying all the data in a table and need some assistance. Can someone please help me resolve this issue? Thank you in advance!
var obj=[
{
id : "01",
name : "Bob",
prof : "Soft Engg"
},
{
id : "02",
name : "George",
prof : "Admin"
},
{
id : "03",
name : "Paul",
prof : "Front End"
}
];
var x = document.createElement("table");
x.setAttribute("id", "myTable");
document.body.appendChild(x);
var y = document.createElement("tr");
y.setAttribute("id", "myTr");
for(i=0; i<obj.length;i++) {
document.getElementById("myTable").appendChild(y);
var z = document.createElement("td");
var t = document.createTextNode(obj[i]["id"]);
z.appendChild(t);
document.getElementById("myTr").appendChild(z);
}