To merge/flatten an array of arrays with JavaScript, we call the flat
method.
For instance, we write
const arrays = [["$6"], ["$12"], ["$25"], ["$25"], ["$18"], ["$22"], ["$10"]];
const merge3 = arrays.flat(1);
console.log(merge3);
to call arrays.flat
with 1 to flatten the arrays
array 1 level deep.
The returned flattened array is assigned to merge3
.