Object.entries的用法
const person={
name:"lydia",
age:21
}
const y=[1,2,3,4]
console.log(Object.entries(person)) //[[name,lydia],[age,21]]
console.log(Object.entries(y)) //[[0,1],[1,2],[2,3],[3,4]]
for(const [x,y] of Object.entries(person)){
console.log(x,y) //name lydia ,age 21
}
for(const [x,z] of Object.entries(y)){
console.log(x,z)
}