我试图在for
每个 JSON 列表中输出所有值,并且每次弹出这个神秘的“未定义”变量。看一看:
HTML:
<span id="1">
</span>
JavaScript:
var lel =
{
1: {
"some": "json",
"list": "that",
"says": "undefined",
},
}
var s;
for(i in lel[1]) {
s+= '<B>' + i + '</B>' + ": " + lel[1][i] + "<br />";
}
document.getElementById('1').innerHTML = s;
结果(跨度)
undefined**some**: json
**list**: that
**says**: undefined
那个“未定义”的东西来自哪里?