let array = [
["1", "2"],
"3",
["4", ["5", "6"] ]
]
alert(array.toString())
// 1, 2, 3, 4, 5, 6
alert(array.join(''))
// 1, 2 3 4, 5, 6
// А нужно: 1 2 3 4 5 6
function _(array) {
const result = [];
array.forEach(element =>
Array.isArray(element)
? result.push(..._(element))
: result.push(element));
return result;
}
let array = [
["1", "2"],
"3",
["4", ["5", "6"] ]
]
console.log(_(array).join(' '))