title: How to check if a key exists in an object in javascript
body: <p>I have the following object literal: </p>
  
  <pre><code>{ 
    'key1': 
    { 
      id: 'rr323',
      d: undefined,
      x: 560,
      y: 150 
    },
    'key2': 
    { 
      id: 'rr231',
      d: undefined,
      x: 860,
      y: 90 
    } 
  }
  </code></pre>
  
  <p>I want to implement an if statement such as below: </p>
  
  <pre><code>if(key DOES NOT exist in object){  
  //perform certain function 
  }
  </code></pre>
  
  <p>I tried the following: </p>
  
  <pre><code>var key = key1;
  if(!(key in global_move_obj)){
   // function
  }
  </code></pre>
  
  <p>But that always returns true value when it should return false. </p>