title: Replace object value with other object's value of the same key with JavaScript
body: <p>I've got two objects, <code>item</code> and <code>results</code>.
  They've both got the same keys but possibly different values, for example:</p>
  
  <pre><code>item.id = '50'
  item.area = 'Mexico'
  item.gender = null
  item.birthdate = null
  
  results.id = '50'
  results.area = null
  results.gender = 'Male' 
  results.birthdate = null
  </code></pre>
  
  <p>What I want to do is exactly the following:</p>
  
  <pre><code>if (item.id == null || items.id == 0)
  {
      item.id = results.id;
  }
  </code></pre>
  
  <p>but I'm looking for a way to do this for each value of my <code>item</code> object. You know, without having to write a huge function if my objects happen to have a lot more keys / values.
  Any ideas? </p>
  
  <p><strong>Update :</strong> I misunderstood my own problem and the only issue was that I didnt really understand how to get an object value given a certain key. I couldnt really use any outside scripts or divs since Im using Azure's mobile service scripts.</p>
  
  <pre><code>for (var key in item) {
      if(item[key] == null || item[key] == 0){
          item[key] = results[0][key] 
      }             
  }
  </code></pre>