The $() function returns a special JavaScript object containing an array of the DOM elements that match the selector
<p>I'm reading jQuery in Action, and on page 6 it says</p>

<blockquote>
  <p>The $() function returns a special JavaScript object containing an
  array of the DOM elements that match
  the selector.</p>
</blockquote>

<p>By 'special', I suppose what it means is it's returning a jQuery object.
But it's the last part of that sentence that I'm struggling to understand: "an array of the DOM elements".</p>

<p>Q: Can you write a function for me that returns "an array of DOM elements"?</p>

<p>Example: $('p') would return all the p tags.  So without writing jQuery from scratch, can you show me in JavaScript code, exactly what is being returned when the author refers to it as "an array of DOM elements"?  </p>

<p>Is it simply an array with each element containing strings such as:</p>

<pre><code>&lt;p&gt;foot&lt;/p&gt;
&lt;p&gt;bar&lt;/p&gt;
</code></pre>

<p>I'm aware of Firebug, but I'm concerned that Firebug might be interpreting what is being returned and representing it for me.  I guess I'm trying to understand exactly what a DOM element is.</p>
