title: Compare arrays and push data to index locations
body: <p>I have the following usecase ,i have two arrays like the below</p>
  
  <pre><code>arr1=[{room_no:1,bed_no:'1A'},
        {room_no:1,bed_no:'1B'},
        {room_no:2,bed_no:'2A'},
        {room_no:3,bed_no:'3A'},
        {room_no:3,bed_no:'3B'},
        {room_no:4,bed_no:'4A'}]
  
   arr2=[
         { patient_details:[{name:'patient1',age:22}],
           patient_room_details:[{room_no:1,bed_no:'1A'}],
           status:'occupied'
         },
         { patient_room_details:[{room_no:1,bed_no:'1B'},
           status:'available'
         },
         {  patient_details:[{name:'patient2',age:32}],
            patient_room_details:[{room_no:2,bed_no:'2A'}],
            status:'occupied'
         }
         { patient_room_details:[{room_no:3,bed_no:'3A'},
           status:'cleaning'
         },
        ]  
  </code></pre>
  
  <p>Iam trying to compare the room_no and bed_no from first array with second array patient_room_details . If the match is found Iam pushing the matched object to an result array with patient_details,patient_room_details and status . If no match is found I need to push only status as AVAILABLE . </p>
  
  <p>Iam not able to push the status as AVAILABLE , if the match is not found , Any help would be appreciated</p>
  
  <p>and the final result would be like</p>
  
  <pre><code>result=[
         { patient_details:[{name:'patient1',age:22}],
           patient_room_details:[{room_no:1,bed_no:'1A'}],
           status:'occupied'
         },
         { patient_room_details:[{room_no:1,bed_no:'1B'},
           status:'available'
         },
         {  patient_details:[{name:'patient2',age:32}],
            patient_room_details:[{room_no:2,bed_no:'2A'}],
            status:'occupied'
         },
         { patient_room_details:[{room_no:3,bed_no:'3A'},
           status:'cleaning'
         },
         { patient_room_details:[{room_no:3,bed_no:'3B'},
           status:'available'
         },
         { patient_room_details:[{room_no:4,bed_no:'4A'},
           status:'available'
         },
        ]
  </code></pre>