et obj ={"a":1,"b":2}
let n = {};
let m = [];
for(let i in obj){
n.name = i;
n.number =obj[i];
}
console.log(n) => {name: "b", number: 2},
如何改进,让m 的结果是 [{name: "a", number: 1},{name: "b", number: 2}]
达令说
相关分类