title: Javascript - Replace undefined with 0
body: <p>I have a variable that gets defined by user input. I want to replace its value only if it's <code>undefined</code>. But not if it's <code>NaN</code>. How can I do it?</p>
  <p>I tried doing <code>x || 0</code> but that also replaces <code>NaN</code> values.</p>