title: forEach method seems to skip an entry
body: <h2>Aim</h2>
  <p>I am trying to make a function which would take an array of &quot;votes&quot; and return an object containing the number of times each &quot;candidate&quot; received a score of 1.</p>
  <p>For example an array such as:</p>
  <pre><code>[
      {
          &quot;blue&quot;: 1,
          &quot;red&quot;: 3,
          &quot;purple&quot;: 2,
          &quot;yellow&quot;: 4
      },
      {
          &quot;blue&quot;: 2,
          &quot;red&quot;: 3,
          &quot;purple&quot;: 4,
          &quot;yellow&quot;: 1
      },
      {
          &quot;blue&quot;: 1,
          &quot;red&quot;: 2,
          &quot;purple&quot;: 4,
          &quot;yellow&quot;: 3
      },
      {
          &quot;blue&quot;: 3,
          &quot;red&quot;: 4,
          &quot;purple&quot;: 2,
          &quot;yellow&quot;: 1
      }
  ];
  </code></pre>
  <p>should return an object</p>
  <pre><code>{
      &quot;blue&quot;: 2,
      &quot;red&quot;: 0,
      &quot;purple&quot;: 0,
      &quot;yellow&quot;: 2
  }
  </code></pre>
  <hr />
  <h2>Current Code</h2>
  <p>Currently I have written the function</p>
  <pre><code>// adds up the first choice results from raw data
  // return object containing number of first choice votes each candidate received
  const add_first_choices = function (raw_data) {
      // create object to store number of first choices
      const storage_obj = empty_candidate_obj(raw_data);
  
      // loop through results, adding first choices to storage_obj
      raw_data.forEach(function (single_voter_obj) {
          Object.values(single_voter_obj).forEach(function (value) {
              if (value === 1) {
                  storage_obj[getKeyByValue(single_voter_obj, value)] += 1;
              }
          });
      });
      return storage_obj;
  };
  </code></pre>
  <p>which uses the following two other functions</p>
  <pre><code>// returns object of candidate names, each with value of 0
  const empty_candidate_obj = function (raw_data) {
      const input_data = raw_data;
      let first_vote = input_data[0];
      const keys = Object.keys(first_vote);
      keys.forEach(function (key) {
          first_vote[key] = 0;
      });
      return first_vote;
  };
  </code></pre>
  <p>and</p>
  <pre><code>// returns key from object value
  const getKeyByValue = function (object, value) {
      return Object.keys(object).find((key) =&gt; object[key] === value);
  };
  </code></pre>
  <hr />
  <h2>Problem</h2>
  <p>When inputting the above array into my function it returns</p>
  <pre><code>{
      blue: 1,
      red: 0,
      purple: 0,
      yellow: 2
  }
  </code></pre>
  <p>=&gt; Not as expected!</p>
  <p>Do you know what I have done wrong?</p>
  <p>Thanks for any replies :)</p>