var obj = {
name:"王中",
age:"26岁",
grade:"毕业",
speciality:"计算机",
girlfriend:"翠花"
};
//判断age是否存在于obj里面
if (obj.hasOwnProperty("age")){
alert("有age项");
}
网友评论