title: Omitting the second expression when using the if-else shorthand
body: <p>Can I write the <code>if else</code> shorthand without the <code>else</code>? </p>
  
  <pre><code>var x=1;
  
  x==2 ? dosomething() : doNothingButContinueCode();   
  </code></pre>
  
  <p>I've noticed putting <code>null</code> for the else works (but I have no idea why or if that's a good idea). </p>
  
  <p><strong>Edit:</strong> Some of you seem bemused why I'd bother trying this. Rest assured it's purely out of curiosity. I like messing around with JavaScript.  </p>