📜  在纯 javascript 中使用 for of 循环将数据填充到 HTML - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:13.495000             🧑  作者: Mango

代码示例1
// blah blah blah ajax call blah blah blah fetch, blah blah blah something else that brings me data

//data comes back as something to iter through
var data = [{
  email: 'something'
}, {
  email: 'something2'
}, {
  email: 'blah'
}, {
  email: 'blah2'
}, {
  email: 'blah blah'
}, {
  email: ':o blah'
}]


data.forEach(item => {
  var div = document.createElement('div')
  div.innerHTML = `
some fancy box//// ${item.email} \\\\\\some more facy box
` document.body.appendChild(div); })