📌  相关文章
📜  如何将数组拆分为两个javascript代码示例

📅  最后修改于: 2022-03-11 15:03:29.328000             🧑  作者: Mango

代码示例2
function cleanUpArray(arr) {
    let intArray = arr.map(x => parseInt(x))
    let evenArray = []
    intArray.map(x => {
        if(x % 2 === 0){
            evenArray.push(x)
        }
    })
        let oddArray = []
    intArray.map(x => {
        if(x % 2 !== 0){
            oddArray.push(x)
        }
    })
    return [evenArray, oddArray]
}