title: re-organizing array of objects
body: <p>So I have an array of objects that contain information for different activities in different projects.
  It looks something like this</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const input = [
    {
      Project: 1,
      ID: "1-1",
    },
    {
      Project: 1,
      ID: "1-2",
    },
    {
      Project: 2,
      ID: "2-1",
    },
  ];</code></pre>
  </div>
  </div>
  </p>
  <p>From this, I would like to go to this</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>output = [{
      Project: 1,
      ID1: 1 - 1,
      ID2: 1 - 2,
    },
    {
      Project: 1,
      ID1: 2 - 1,
    },
  ];</code></pre>
  </div>
  </div>
  </p>
  <p>Here's what I have so far:</p>
  <pre><code>let currentProject = ''
  let output = []
  
  
  for (const e of input) {
    let counter
    let outputObj = {}
  
    if (currentProject !== e.Project) {
      output.push(outputObj)
      counter = 1
      outputObj = {}
  
      outputObj.projectNum = e.Project
  
      currentProject = e.Project
    }
  
    if (currentProject == e.Project) {
      outputObj['ID' + counter] = e.ID
      counter++
    }
  
  }
  </code></pre>
  <p>here's what I'm getting back:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>output = [{
      Project: 1,
      ID1: 1 - 1
    },
    {
      Project: 1,
      ID1: 2 - 1
    }
  ]</code></pre>
  </div>
  </div>
  </p>
  <p>I'm not sure what the issue is, tried several times to fix it.
  Could someone please help me get over the edge?
  Any help will be greatly appreciated.</p>