Javascript - If statements check both expression and definition declaration? This is confusing
<pre><code>var boolTrue = true;
var randomObject;

if (boolTrue)
// this will fire

if (randomObject)
// this will fire, because the object is defined

if (!objectNotDefined)
// this will fire, because there is no defined object named 'objectNotDefined'
</code></pre>

<p>Coming from a C++ and C# background, I am very familiar with the basic if(expression) syntax.  However, I think it is not very readable to have both expressions (true/false) and have object existence also being a expression.  Because now if I see a function like below, i don't know if the data coming in is an object (existence/undefined check) or a boolean.</p>

<pre><code>function(data) {
   if (data)
      // is this checking if the object is true/false or if the object is in existence?
}
</code></pre>

<p>Is this just the way it is?  I mean, is there anyway to easily read this?  Also, where is this documented anywhere in the JS spec (curious)?</p>
