liuxin-1811a

let arr = [1, {}, [3, [4]] ]; let arr1 = []; arr1 = arr.flat(Infinity); console.log(arr1);

Usage no npm install needed!

<script type="module">
  import liuxin1811a from 'https://cdn.skypack.dev/liuxin-1811a';
</script>

README

降维

let arr = [1, {},
    [3, [4]]
];
let arr1 = [];
arr1 = arr.flat(Infinity);
console.log(arr1);