title: How to merge two objects (associative array) with same key into one object
body: <p>I have two objects: </p>
  
  <pre><code>var arr= [
    0: { selectedAns: "test answer 1", id: "28", status: "answered" }
  ]
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>var answerList = [
    0: { selectedAns: "test answer 2 ques 5", id: "27", status: "answered" },
    1: { selectedAns: "test answer 3 ques 6", id: "29", status: "answered"}
  ]
  </code></pre>
  
  <p>When I do this:</p>
  
  <pre><code>arr1.push(arr);
  arr1.push(answerList);
  </code></pre>
  
  <p>I am getting this result:</p>
  
  <pre><code>var arr1=[0:{
      0:{selectedAns: "test answer 2 ques 5", id: "27", status: "answered"}
  }
  1:{
      0:{selectedAns: "test answer 1", id: "28", status: "answered"}
      1:{selectedAns: "test answer 3 ques 6", id: "29", status: "answered"}
  }]
  </code></pre>
  
  <p>But I want something like this:</p>
  
  <pre><code>    var arr1=[
      0:{selectedAns: "test answer 2 ques 5", id: "27", status: "answered"}
  
      1:{selectedAns: "test answer 1", id: "28", status: "answered"}
  
      2:{selectedAns: "test answer 3 ques 6", id: "29", status: "answered"}
  ]
  </code></pre>
  
  <p>What am I doing wrong? Thanks.</p>
  
  <p>Note: I am removing duplicates from objects before merging two objects, even if any key has duplicate value like here in status key. Still, I need to merge both the objects. Per my requirement only the id key needs to be unique, so I need a way to merge the two objects as above.</p>