利用forin 动态创建表格
let hd = [{
title: "第一章 走进JAVASCRIPT黑洞",
lesson: 3
}, {
title: "ubuntu19.10 配置好用的编程工作站",
lesson: 5
}, {
title: "媒体查询响应式布局",
lesson: 8
}];
document.write(`<table border='1' width="500px">
<thead>
<tr>
<th>标题</th>
<th>内容</th>
</tr>
</thead>
`)
for (let key in hd) {
document.write(`
<tr>
<td>${hd[key].title}</td>
<td>${hd[key].lesson}</td>
</tr>
`)
}
document.write(`</table>`)