What is the difference between .length and [0] to check if an element with an ID exists
<p>I have seen two ways to check if an element with a specific ID exists on the page and I was wondering why the second way works.</p>

<p>One way I have seen is the following and I think I understand it:</p>

<pre><code>if ( $('#elementID').length &gt; 0 ) {
  //Do something
}
else {
  //Do something else
}
</code></pre>

<p>Another way I have seen this done that I do not quite understand is the following:</p>

<pre><code>if ( $('#elementID')[0] ) {
  //Do something
}
else {
  //Do something else
}
</code></pre>

<p>What does the [0] mean?  I normally see [...] used for array's so is this returning an array?</p>

<p>Thank you.</p>
