title: Shorthand if/else statement Javascript
body: <p>I'm wondering if there's a shorter way to write this:</p>
  
  <pre><code>var x = 1;
  if(y != undefined) x = y;
  </code></pre>
  
  <p>I initially tried <code>x = y || 1</code>, but that didn't work. What's the correct way to go about this?</p>