title: Avoid loops in javascript to optimise code
body: <p>I have two array.</p>
  
  <ol>
  <li><p>An array of object</p>
  
  <pre><code>[ {id:1,name:”temp1”}, 
    {id:2,name:”temp2”}, 
    {id:3,name:”temp3”}, 
    {id:4,name:”temp4”}
  ]
  </code></pre></li>
  <li><p>An array</p>
  
  <pre><code>[3,4]
  </code></pre></li>
  </ol>
  
  <p>I need an output</p>
  
  <pre><code>[ {id:3,name:”temp3”}, 
    {id:4,name:”temp4”}
  ]
  </code></pre>
  
  <p>Without using a loop.
  Do javascript have such functions to optimise code?</p>