Reply
Mon 20 Jul, 2015 06:06 pm
//write a function below called “oddsAndEvens” that loops through a //parameter “num” (an array), for each number in the given array, if it is even, it is added to the evens array, if the number is odd, it is added to the odds array.
//this is what i think
function oddsAndEvens(nums) {
for (var i = 0; i < nums.length; i++) {
if (nums % 2 === 0) {
evens.push(nums)
} else {
odds.push(nums)
}
}
}
would you change this at all ?