创建初始化一个对象做例子
var person = {
"name": "gongao",
"sex": "man",
"age": "23"
}//object
遍历key(键)
for ( let key in person)
{
console.log(key)
}// name sex age
遍历value(值)
for (let key in person)
{
console.log(person[key])
}// gongao man 23
网友评论