You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617
  1. 'use strict'
  2. let array = [2, 3, 13, 18, -5, 38, -10, 11, 0, 104];
  3. let even = [];
  4. let odd = [];
  5. for (let i = 0; i <= array.length - 1; i++) {
  6. if (array[i] % 2 === 0) {
  7. even.push(array[i]);
  8. } else {
  9. odd.push(array[i]);
  10. }
  11. if (i === array.length - 1) {
  12. console.log(even);
  13. console.log(odd);
  14. }
  15. }