how to retrun a flattend array code example
Example 1: flatten an array javascript
var arrays = [
["$6"],
["$12"],
["$25"],
["$25"],
["$18"],
["$22"],
["$10"]
];
var merged = [].concat.apply([], arrays);
console.log(merged);
Example 2: flatten nested array javascript
const arr2 = [1, 2, [3, 4, [5, 6]]];
arr2.flat();