Concat several arrays in JavaScript (nodejs) -


what more concise way concat ar arrays in 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); }, []); 

you may try this:

[].concat.apply([], [array1, array2, ...]) 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -