Merge/flatten an array of arrays
You can use concat to merge arrays: Run code snippetExpand snippet Using the apply method of concat will just take the second parameter as an array, so the last line is identical to this: There is also the Array.prototype.flat() method (introduced in ES2019) which you could use to flatten the arrays, although it is only available in Node.js starting with version 11, and not … Read more