1错忱、使用Object.keys()遍歷
const str={"name":"duxin","num":"253","index":"958"}
Object.keys(str).forEach((key)=>{console.log(key)})
2、for..in遍歷
for(let i in str){
console.log(i+"===="+str[i])
}
3挂据、Object.getOwnPropertyNames(obj)
Object.getOwnPropertyNames(str).forEach((key)=>{
console.log(key+"===="+str[key])
})
4以清、Reflect.ownKeys(obj)
Reflect.ownKeys(str).forEach((key)=>{
console.log("對象索引為:"+key)
})