How to check in an object whether its has the key or not?
<pre><code>var object = [{key1:'value',key2:'value2'},{'key1:'value',key2:'value2}]

for (var key in object)
     {
      if(!object.hasOwnProperty(key)){continue;}
</code></pre>

<p>Why do we get error? Am i checking the right way. </p>

<p>I get an <code>error cannot call hasOwnProperty in an Object - TypeError</code></p>
