function that accepts a parameter and is a numeric array and it will cross the array and if the element is even it will push to the one "par" array and if it is odd it will push to the "odd" array
I tried to do it this way below but nothing worked. What would be the correct solution?
function PickIt(array) {
var array = [1, 2, 3, 4, 5];
var par = [];
var impar = [];
for (var i = 0; i < array.length; i++) {
if (array[i] % 2 === 0) {
return par.push(array[i]);
} else {
return impar.push(array[i]);
}
}
}
PickIt();