Check for an empty map
<p>I'm having an interesting issue that I'm sure is easily explained, but the explanation is eluding me.</p>

<p>An undefined or null object in javascript is equal to false.
</p>

<pre><code>var x;
alert(!x); //returns true
alert(x==true); //returns false
</code></pre>

<p>What about an empty array object? Is that the equivalent of true or false?</p>

<pre><code>var x = [];
alert (x==true); //returns false
alert (!x); //returns false
</code></pre>

<p>If it is equivalent to true, how do I check if it's non-empty? I was hoping to do</p>

<pre><code>if (!x) {
    //do stuff
}
</code></pre>

<p>I tried checking <code>x.length</code>, but I'm using this object as a map:</p>

<pre><code>var x = [];
alert(x.length); //returns 0
x.prop = "hello"; 
alert(x.length); //still returns 0
</code></pre>

<p>How can I check if my map is empty?</p>
