title: Find the parity outlier Javascript
body: <p>My function fails (returns undefined) when the answer is a negative odd number only.
  Otherwise it works.
  Can anyone see why?</p>
  
  <p>Instructions:</p>
  
  <blockquote>
    <p>You are given an array (which will have a length of at least 3, but could be very large) containing integers. The array is either entirely comprised of odd integers or entirely comprised of even integers except for a single integer N. Write a method that takes the array as an argument and returns this "outlier" N.</p>
  </blockquote>
  
  <p>My code:</p>
  
  <pre><code>function findOutlier(integers) {
    let binary = integers.map((int, i) =&gt; int % 2);
    let count = 0;
    for (let i = 0; i &lt; binary.length; i++) {
      if (binary[i] == 0)
        count++;
    }
    if (count &gt; 1) {
      return integers[binary.indexOf(1)]
    } else {
      return integers[binary.indexOf(0)]
    }
  }
  </code></pre>