JSFiddle - React, Tailwind, and code Playground
HTML
<p id="stat_tbl"></p>
JavaScript
const obj = {
1: {name: 'foo', code: 123},
2: {name: 'doo', code: 123},
3: {name: 'goo', code: 123},
4: {name: 'joo', code: 123}
}
let tbl = document.getElementById("stat_tbl")
var txt = ""
txt += "<table>"
txt += "<tr><th>Name</th><th>Code</th></tr>"
for(x in obj) {
txt += "<tr><td>" + obj[x].name + "</td>"
txt += "<td><button type='' id='btnclick' onclick='tes()' value='" + obj[x].code + "'>Show Code</button></td></tr>"
}
txt += "</table>"
tbl.innerHTML = txt