title: Checking if a jQuery selector doesn't find any results
body: <p>I'm used to Prototypejs, where $$("selector") will return null if no elements were found. This is convenient because I can do</p>
  
  <pre><code>if ($$("selector")) {}
  </code></pre>
  
  <p>to check if an element is in the DOM.</p>
  
  <p>However, in jQuery $(selector) will return [] if no element is found, so now I need to do:</p>
  
  <pre><code>if ( $(selector).length &gt; 0 )
  </code></pre>
  
  <p>This makes code slightly harder to read.</p>
  
  <p>My question: What's the best way of doing this? Should I extend the jQuery object with methods like .empty() and .any(), or are there built in functions to do this?</p>
  
  <p>Update: This also applies to other selectors on jQuery which should, anyways, only return one result (like parent(), or closest())</p>