📜  对于每个附加到文档 - Javascript 代码示例

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

代码示例1
var person = {
    firstName: "john",
    lastName: "doe",
    age: 45,
    placeOfBirth: "somewhere"
}

for(var key in person) {
    
        var p = document.createElement("p");
        p.innerHTML = person[key];
        document.body.appendChild(p)
    
}