var obj = new Object();
obj.name = "Xinhe";
obj.gender = "female";
obj.email = "test@gmail.com";
console.log(obj);
var obj = {
name : "Xinhe",
gender: "female",
email: "test@gmail.com"
}
console.log(obj);
console.log("姓名:", obj.name);
<p>姓名:</p>
<p>性別:</p>
<p>E-mail:</p>
var obj = {
name : "Xinhe",
gender: "female",
email: "test@gmail.com"
}
document.getElementsByTagName("p")[0].innerHTML += obj.name;
document.getElementsByTagName("p")[1].innerHTML += obj.gender;
document.getElementsByTagName("p")[2].innerHTML += obj.email;