Jak podzielić tablicę na dwa JavaScript
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]
}
Anthony Smith