对象键和数组值
var object = {
key1: 10,
key2: 3,
key3: 40,
key4: 20
};
var array = [];
for(var people in object) {
array.push([people, object[people]]);
}
现在数组是
[
["key1", 10],
["key2", 3],
["key3", 40],
["key4", 20]
]
var object = {
key1: 10,
key2: 3,
key3: 40,
key4: 20
};
var array = [];
for(var people in object) {
array.push([people, object[people]]);
}
现在数组是
[
["key1", 10],
["key2", 3],
["key3", 40],
["key4", 20]
]