title: Creating key-value paired Object from array with Array.map()?
body: <pre><code>const people = ['Peter','Henry','James'];
  const unqiue = ['ID_1','ID_2','ID_3'];
  let map = unique.map((id, i) =&gt; {
      return { name: people[i], id: id };
    });
  </code></pre>
  
  <p>This gives me sth like</p>
  
  <pre><code>{
   0: {
    person: 'peter',
    id: ID_A
   },
   1: {
    person: 'simon',
    id: ID_B
   }
  }
  </code></pre>
  
  <p>However, I'd like to get back an object keyed by IDSs:</p>
  
  <pre><code>{
   ID_A: {
    person: 'peter',
    id: ID_A
   },
   ID_B: {
    person: 'simon',
    id: ID_B
   }
  }
  </code></pre>
  
  <p>How could I do this here, I seem not come up with the right thing. I tried this, but doesnt work at all:</p>
  
  <pre><code>let map = unique.map((id, i) =&gt; {
      return [id] : { name: people[i], id: id };
    });
  </code></pre>