How can I test whether this Javascript object has any properties?
<p>I have some code that adds properties to an object like this:</p>

<pre><code>var MyObject = new Object();

if (....) { MyObject.prop1 = .... ; }
if (....) { MyObject.prop2 = .... ; }
if (....) { MyObject.prop3 = .... ; }
</code></pre>

<p>After going through all these if statements, I want to test and see whether <code>MyObject</code> has properties. I don't want to test if it has <code>prop1 || prop2 || prop3</code> because there are 12 properties that can be added. </p>

<p>How do I test to see if it has at least one? I tried <code>if (MyObject)</code> but of course that doesn't work because that only tests the existence of the object. Is these something like a simple one-liner like <code>(MyArray.length)</code> for objects?</p>
