title: How do I go about creating a javascript object that stores the count of unique objects?
body: <p>Lets say I have an array</p>
  <pre><code>['Student', 'Progress', 'Student', 'Area']
  </code></pre>
  <p>I would like to have an object that looks like this...</p>
  <pre><code> {
      {
        value: &quot;Student&quot;,
        count: 2
      },
      {
        value: &quot;Progress&quot;,
        count: 1
      }
   }
  </code></pre>
  <p>The code I am using currently is this... which clearly is wrong. Any help would be appreciated.</p>
  <pre><code>    const counts = [];
      for (let i = 0; i &lt; array.length; i++) {
          var object = {
                  value: counts[array[i]],
                  count: (1 + (counts[array[i]] || 0))
          }
          counts.push(object);
      };
      return counts;
  </code></pre>