title: How to merge two array of objects in javascript
body: <p>How to merge the two array of objects in one array,the given array of objects like below.</p>
  
  <pre><code>var arr1=[{key:2000,value:100},{key:2001,value:200},{key:3000,value:300}]
  var arr2=[{key1:2000,value1:100},{key1:2001,value1:200},{key1:3000,value1:300}]
  </code></pre>
  
  <p>Expected output:</p>
  
  <pre><code>[
    {
      "key": 2000,
      "value": 100,
      "child": [
        {
          "key1": 2000,
          "value1": 100
        }
      ]
    },
    {
      "key": 2001,
      "value": 200,
      "child": [
        {
          "key1": 2001,
          "value1": 200
        }
      ]
    },
    {
      "key": 3000,
      "value": 300,
      "child": [
        {
          "key1": 3000,
          "value1": 300
        }
      ]
    }
  ]
  </code></pre>