JavaScript将类数组转换为数组的三种方法

        // 类数组转换为数组
        const list = [] // 假定为类数组

        const arr1 = Array.from(list);
        const arr2 = Array.prototype.splice.call(list);
        const arr3 = [...list];
posted @ 2022-04-06 23:30  azoux  阅读(176)  评论(0编辑  收藏  举报