<div class="container positions">
<h2>Job Openings</h2>
<ul>
<li class="pos-card" id="Jobcontainer">
</div>
</ul>
</div>
function gotData(data) {
var jobs = data.val();
var keys = Object.keys(jobs);
var container = document.getElementById('Jobcontainer');
for (var i = 0; i<keys.length; i++) {
var k = keys[i];
var newCard = `
<li class="pos-card" id="Jobcontainer">
<div class="content">
<div class="title">`+ jobs[k].JobTitle + `</div>
// <div class="dept">jobs[k].</div>
<div class="date">April 21</div>
<div class="refer">Refer</div>
</div>
<ul class="desc">
<li>`+ jobs[k].JobSummary + `</li>
</ul>
</li>`;
container.innerHTML += newCard;
}
}
style
它不断返回此错误,我无法弄清楚我做错了什么。 TypeError:无法将undefined或null转换为object 在Function.keys() 在gotData(Jobboard.html:136) 有谁知道如何解决这个问题?