I want to merge values of multiple arrays in one object to one array. For instance:
Object:
- alpha: Array[3]
0: "vatG4d6mcjKbpfuAm"
1: "xkQrKEsfwuYPkDcdz"
2: "GDg9chZnDGrbLXWGS"
- bravo: Array[1]
0: "53LEcQ5MoYXFyvktf"
- …
The result should be:
["vatG4d6mcjKbpfuAm", "xkQrKEsfwuYPkDcdz", "GDg9chZnDGrbLXWGS", "53LEcQ5MoYXFyvktf"]
I did this with a simple for loop iterating over the elements, but I am concerned about the performance. Is this possible with a simple jQuery or underscore.js function?
Any help would be greatly appreciated.
mergedoes exactly that. It just loops through the supplied arrays:merge:function(first,second){ for(;j<len;j++){ first[i++]=second[j]; }(And some more stuff)