将数组中的空元素转为 undefined

index.js

const list = [1, , 3];

Array.apply(null, list); // [1, undefined, 3]

[...list]; // [1, undefined, 3]

posted on 2021-09-10 10:11  aisowe  阅读(148)  评论(0编辑  收藏  举报

导航