How can make a function object similar to the one in jQuery?
<p>I have 2 questions, please give me some advice.</p>

<p>I am trying to find out how jQuery works.  After reading its code, I found that jQuery is simply returning <code>this</code> from its function object.  There's an easy example around line <code>2975</code>.</p>

<p>So it will be similar to this code below :</p>

<pre><code>var a = new function a ( ) {
        return this;
    };
a[0] = document.querySelectorAll( 'div#1' ) ;

console.log(a)

var b = new function ( ) {
        this[0] = document.querySelectorAll( 'div#1' )  ;
        return this;
    };

console.log(b)

console.log(jQuery('#1'))
</code></pre>

<p>However about when I check the console, </p>

<p><a href="https://i.stack.imgur.com/0p2Ll.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0p2Ll.png" alt="enter image description here"></a></p>

<p>as you can see, jQuery doesn't have <code>jQuery</code> in front of the object, and the object is more like Array it quoted by <code>[ ]</code> and the prototype is <code>Object[0]</code> .</p>

<p>and <code>__proto__: Object[0]</code> has no <code>constructor</code> inside.</p>

<p>My questions are how does jquery makes a new function instance without the function name in front, and what is this <code>__proto__: Object[0]</code> ?</p>

<p>Thank you very much!</p>