最佳答案
给定一个 JavaScript 对象:
var dataObject = {
object1: {id: 1, name: "Fred"},
object2: {id: 2, name: "Wilma"},
object3: {id: 3, name: "Pebbles"}
};
如何有效地将内部对象提取到数组中? 我不需要维护 对象[ n ] ID 的句柄。
var dataArray = [
{id: 1, name: "Fred"},
{id: 2, name: "Wilma"},
{id: 3, name: "Pebbles"}]