Press array subscripts odd and even split array

es6:

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

 

Guess you like

Origin www.cnblogs.com/520BigBear/p/11457273.html
Recommended