> a = {"1":[1,2,3], "2":[2,3,4], "3":[3,4,5]}
{ '1': [ 1, 2, 3 ],
'2': [ 2, 3, 4 ],
'3': [ 3, 4, 5 ] }
> Object.keys(a)
[ '1', '2', '3' ]
>
Excuse me, is there a way to get the value set [[1,2,3],[2,3,4],[3,4,5]]?
我想大声告诉你2017-05-16 13:23:43
I usually use this kindunderscore
npm install underscore --save
var _ = require('underscore');
var a = {"1":[1,2,3], "2":[2,3,4], "3":[3,4,5]};
var values = _.values(a);
console.log(values);
高洛峰2017-05-16 13:23:43
First of all, the dictionary is unordered, so the obtained set is also unordered. It is the default order of the browser
You can use for in
var arr = [];
var cont = 0;
for(var i in a){
for(var j=0; j<a[i].length;j++){
arr[cont].push(a[i][j])
}
cont++;
}
console.log(arr)
There will definitely be no problem with compatibility like this