按数组下标奇数偶数分割数组

es6:

//分隔数组   135   /  246
        funcArray(arr){
            const even = arr.filter((_item, index) => index % 2 === 0);
            const odd = arr.filter((_item, index) => index % 2 !== 0);
        },

猜你喜欢

转载自www.cnblogs.com/520BigBear/p/11457273.html
今日推荐