更新时间:2022-06-21 23:56:04
You could use Object.assign
with an array as target object.
var data = { 0: { abc: 123, xyz: 456, foo: null, bar: 0 }, 1: { abc: 235, xyz: 556, foo: null, bar: 0 } },
array = Object.assign([], data);
console.log(array);
或者只是 Object.值
(如果索引无关紧要).
Or just Object.values
if the index does not matter.
var data = { 0: { abc: 123, xyz: 456, foo: null, bar: 0 }, 1: { abc: 235, xyz: 556, foo: null, bar: 0 } },
array = Object.values(data);
console.log(array);