How do I check to see if an object has an attribute in Javascript?
<p>So:</p>

<pre><code>x = {'key': 1};
if ( x.hasOwnProperty('key') ) {
    //do this
}
</code></pre>

<p>Is that the best way to do that?</p>
