collapse arrays within an array code example
Example 1: js convert array of arrays to array
// Converts array with multiple values into a single array with all items:
var merged = [].concat.apply([], arrays);
Example 2: Javascript flatten array of arrays
var multiDimensionArray = [["a"],["b","c"],["d"]]; //array of arrays
var flatArray = Array.prototype.concat.apply([], multiDimensionArray); //flatten array of arrays
console.log(flatArray); // [ "a","b","c","d"];