What would be the more concise way to concat all ar arrays in the following object:
var obj = {
field1: {
ar: [...]
},
field2: {
ar: [...]
},
...
fieldN: {
ar: [...]
}
}
I found this:
Object.keys(obj).reduce(function(array, entry) {
return array.concat(obj[entry].files);
}, []);
您可以这样尝试:
[].concat.apply([], [array1, array2, ...])
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.