我有-我认为很简单的问题-但我知道了:
[[a, b, ... ,n]]
,我想将其转换为
[a, b, ..., n]
答案 0 :(得分:1)
const arr = [[1, 2, 3, 4]];
console.log(arr.flat());
您还可以使用Array.flat()
:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat