title: Cast undefined to 0
body: <p>Is there a succinct operation in JavaScript (ES2015) that does this:</p>
  
  <pre><code>x =&gt; x === undefined ? 0 : x
  </code></pre>
  
  <p>I keep running into situations where I want to increment <code>x</code>, but it's initially undefined, so the code becomes:</p>
  
  <pre><code>foo.bar = (foo.bar === undefined ? 0 : foo.bar) + 1;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>foo.bar = (foo.bar ? foo.bar : 0) + 1;
  </code></pre>
  
  <p>Is there a less repetitive way of doing this cast?</p>