title: Is there a jQuery function to "shortcut" a if/else switch?
body: <p>Writing if/else statements in the middle of jQuery code doesn't feel right:</p>
  
  <pre><code>if ($("#test").length) {
    // do smth
  }
  else {
    // do smth else
  }
  </code></pre>
  
  <p>Is there something similar to:</p>
  
  <pre><code>$("#test").test(function(){
    // do smth
  }, 
  function(){
    // do smth else
  });
  </code></pre>