title: how to push array object to array object javascript
body: <p>How to push the object into array of property value matches in javascript.</p>
  <p>I have objects <code>obj1</code> and <code>obj2</code>, in which if property <code>name</code> matches</p>
  <p>then push the prop of object <code>obj2</code>, how to implement in javascript</p>
  <pre><code>function arrayobj(obj1, obj2){
    var obj = obj2.map(e=&gt;({
            info: {
              id: e.id,
              qty: e.qty
            }
           }));
  }
  
  var obj1 = [
   {
    idx:1,
    name: &quot;sample1&quot;
   },
   {
    idx:2,
    name: &quot;sample2&quot;
   }
  ]
  
  var obj2=[
    {
      id:1,
      name: &quot;sample1&quot;,
      qty: 10
    },
    {
      id:3,
      name: &quot;sample1&quot;,
      qty: 30
    },
    {
      id:2,
      name: &quot;sample2&quot;,
      qty: 20
    }
  ]
  
  </code></pre>
  <p>Expected Output:</p>
  <pre><code>[
   {
    idx:1,
    name: &quot;sample1&quot;,
    info: [
      {id:1, qty:10},
      {id:3, qty:30}
    ]
   },
   {
    idx:2,
    name: &quot;sample2&quot;,
    info: [
     {id:2, qty:20}
    ]
   }
  ]
  
  
  </code></pre>