title: How to use reduce to return an object in Javascript?
body: <p>I'm trying to count the number of odd and even numbers in an array by using the Array.reduce() method. When I run the below code, I get the error "odd is not defined." How/where do I define odd to get this code to work?</p>
  
  <pre><code>var numbers = [5, 3, 8, 6, 9, 1, 0, 2, 2];
  var oddEvenCounts = numbers.reduce(function(counts, number) {
     if (number % 2 === 1) {
       counts[odd]++
     } else {
       counts[even]++;
     }
     return counts;
   }, {});
  </code></pre>