Arrays 9.9.1. for Practice - Need help!

9.9.1. for Practice

  1. Construct a for loop that sorts the array [2, 3, 13, 18, -5, 38, -10, 11, 0, 104] into two new arrays:
  2. Define an empty evens array to hold the even numbers and an odds array for the odd numbers.
  3. In the loop, determine if each number is even or odd, then put that number into evens or odds, as appropriate.
  4. Print the arrays to confirm the results. Print evens first. Example: `console.log(evens);

This prints Odd and Even arrays but also print empty elements in array. I am stuck at the point to print the clear array. Does anyone has anything to add/help? Thank you!

I’m stuck here too. Is it possible to put if else statements in a for loop?

Nevermind, that was dumb.

It has to start like this:

for (i=0;i<arr.length;i++){
evens=evens + arr[i]
odds=odds + arr[i]

but only returns the same as the array. Now I need it to skip around a little.

I just remembered 4.6.2