title: Merging two multidimensional objects if they have the same key value in javascript
body: <p>If I have two objects. How can I populate the first object with items of the second using values of the first as a key? Say that for the following example, I need the first object to contain all items from the second object with the same color as any of the first objects.</p>
  
  <pre><code>object1 = {
    1:{
      name:'bed',
      color:'blue'
    }
  }
  
  
  object2 = {
    1:{
      name:'chair',
      color:'blue'
    },
  
    2:{
      name:'table',
      color:'red'
    }
  }
  </code></pre>
  
  <p>So this should result in </p>
  
  <pre><code>object1 = {
  
    1:{
      name:'bed',
      color:'blue'
    },
  
    2:{
      name:'chair',
      color:'blue'
    }
  
  }
  </code></pre>