How to make js check for 0 instead of undefined
<p>I have a function which takes a parameter and performs some calculations with it. The parameter is a number. However, when the parameter is 0, js treats it as undefined. So if I have a check for it like:  </p>

<p><code>if (param == 0) { ... }</code>  </p>

<p>This is always false because <code>param==0</code> is <code>false</code> but <code>param==undefined</code> is true.
So I have to rewrite the code and have a special case for when param=0.  </p>

<p>Example:<br>
<code>result= param*123*456 +789;</code>
This has to be changed to:  </p>

<pre><code>if (param == undefined) {
  result= 789;
} else {
  result= param*123*456 +789;
}
return result;
</code></pre>

<p>This is repeating code. There must be a better way. What is the better way?</p>
