Why does jQuery do this in its constructor function implementation?
<p>If we look at the latest jQuery source at <a href="http://code.jquery.com/jquery-latest.js" rel="nofollow">http://code.jquery.com/jquery-latest.js</a> we see the following:</p>

<pre><code>var jQuery = function( selector, context ) {
    // The jQuery object is actually just the init constructor 'enhanced'
    return new jQuery.fn.init( selector, context );
}
</code></pre>

<p>My understanding of the new keyword in Javascript is essentially JavaScript passes the function an empty object <code>{}</code> and the function sets stuff on it via <code>this.blah</code>.</p>

<p>Also from my understanding <code>new</code> differs from <code>.call</code>/<code>.apply</code> etc.. in that the return object also has the prototype set to that of the function. So the return value should have a prototype that the same as <code>jQuery.prototype.init.prototype</code> (or <code>jQuery.fn.init.prototype</code>). However from what I see its prototype is set to <code>jQuery.prototype</code> thus all the commands available to work on the set.</p>

<p>Why is this? What am I missing in my understanding?</p>
