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