title: how to get array from object with index as one of the object property
body: <p>I have an object</p>
  <pre><code>const items = {
    &quot;123&quot;: {
      &quot;key&quot;: 123,
      &quot;name&quot;: &quot;one name&quot;,
      },
      &quot;456&quot;: {
      &quot;key&quot;: 456,
      &quot;name&quot;: &quot;two name&quot;,
      },
      &quot;789&quot;: {
      &quot;key&quot;: 789,
      &quot;name&quot;: &quot;three name&quot;,
      },
      };
  </code></pre>
  <p>Need to filter this from below array, with array index as object.key</p>
  <pre><code>const myFilter = [123,789];
  </code></pre>
  <p>Code I am trying is as below but it returning array inedx as 0,1,2... but I need the index to be object.key.</p>
  <pre><code>let selectedItems = myFilter.map((key) =&gt; {
          return items[key];
        });
  </code></pre>
  <p>Current output :</p>
  <pre><code>[0:{
    key: 123,
    name: &quot;one name&quot;
  }, 1: {
    key: 789,
    name: &quot;three name&quot;
  }]
  </code></pre>
  <p>Expected Output</p>
  <pre><code>[123:{
    key: 123,
    name: &quot;one name&quot;
  }, 789: {
    key: 789,
    name: &quot;three name&quot;
  }] 
  </code></pre>
  <p>jsfiddle - <a href="https://jsfiddle.net/kb374exh/2/" rel="nofollow noreferrer">https://jsfiddle.net/kb374exh/2/</a></p>