How can jQuery seemingly be both an object and a method invoked by an object?
<p>There's a workaround function for an API object called <a href="http://wiki.greasespot.net/UnsafeWindow" rel="nofollow"><code>unsafeWindow</code></a> for browsers that don't support it (<a href="http://mths.be/unsafewindow" rel="nofollow">via this person's github</a>) </p>

<pre><code>var unsafeWindow = (function() {
    var e1 = document.createElement('p')
    e1.setAttribute('onclick', 'return window;');
    return e1.onclick();
})();

// If the current document uses a JavaScript library, you can use it in
// your user script like this:
console.log(unsafeWindow.jQuery);
</code></pre>

<p>If <code>unsafeWindow</code> is an object (or in this case a function designed to mimic the object), how can it be used like <code>$ = unsafeWindow.jQuery</code>? I know this is how you map the function to the <code>$</code> instead of the <code>$</code> being a simple jQuery alias, but I'm just confused as to why, since I thought <code>jQuery</code> itself was an object, and is being invoked here like one would a method.</p>

<p><em>Edit: Thank you for your answers, I wish I could "check mark" all of you, thanks for the help!</em></p>
