title: Javascript redefine Infinity, NaN, or "" as 0
body: <p>I have a javascript calculator which accepts user input, does some math and writes the result to the input field "#theResult"</p>
  
  <p>Since "#theResult" updates on keyup, there are times when "#theResult" will return Infinity, NaN, or "" until all of the fields are filled out. Until all of the fields are filled out, I want "#theResult" to return 0 instead. Here is the code:</p>
  
  <pre><code>if (theResult === Infinity || theResult === "" || theResult === NaN) {
      theResult === 0;
  }
  $("#theResult").val(theResult);
  </code></pre>
  
  <p>The full code is <a href="http://jsfiddle.net/RqzPk/33/" rel="nofollow">here</a></p>
  
  <p>Thanks in advance for any help!</p>