JavaScript merge multiple arrays in one.

 

You can use the JavaScript flat() method to merge multiple arrays as one array.

 

let arrayToMerge = [[0,1], [2,3], [4,5,6,7],[8]];

var mergedArray = arrayToMerge.flat();

print('merged array')
console.log(mergedArray);

 

 

 


Tags:

Share:

Related posts