Answer the question
In order to leave comments, you need to log in
How to display an array with nested arrays in one line, without commas?
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
Answer the question
In order to leave comments, you need to log in
const array = [
["1", "2"],
"3",
["4", ["5", "6"], ["7", "8"] ],
["9", "10", ["11", "42"]]
]
const res = array.flat(Infinity).join(" ");
console.log(res);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question