Why is it possible to query jQuery('div') like an array?
<p>I got another question regarding jQuery's architecture. <code>$('div')</code> constructs a new <code>jQuery</code> object:</p>

<pre><code>$('div') instanceof jQuery; // true
</code></pre>

<p>I'd like to know why it is possible to query it like an array, allthough it isn't an array?</p>

<pre><code>$('div')[0]; // returns the first div in the document as a DOM node.
$.isArray($('div')); // false
</code></pre>

<p>I just love this syntax, it looks so clean! I also noticed this returns the DOM nodes as an array:</p>

<pre><code>console.log($('div'));
</code></pre>

<p>Can somebody explain me how to implement this behaviour to my own objects? </p>

<hr>

<p>My own approach was to make an array with some methods like this:</p>

<pre><code>var a = ['a', 'b', 'c'];
a.method = function(){ return 'test'; };
a; // ['a', 'b', 'c']
a[0]; // 'a'
a.method(); // 'test'
</code></pre>

<p>However this doesn't seem to be the way jQuery does it as this is actually an array:</p>

<pre><code>$.isArray(a); // true
</code></pre>

<p>I'd like to know how jQuery does this to learn and to see if it's a better solution than mine.</p>
