Evaluating an object false within a conditional
<p>Let's suppose we have defined a queue object and we want to loop while there are items in the queue.</p>

<p>The obvious solution:</p>

<pre><code>var queue = new Queue();
// populate queue
while (queue.size()) {
    queue.pop();
}
</code></pre>

<p>The desired form: </p>

<pre><code>var queue = new Queue();
// populate queue
while (queue) { // should stop when queue's size is 0
    queue.pop();
}
</code></pre>

<p>Is it possible to achieve this (exact) syntax showed in the second example javascript? If so, how?</p>
