title: Javascript if only works outside function
body: <p>I can't get my javascript function to work.</p>
  
  <pre><code>if (!cHp) { cHp = 200 };
  </code></pre>
  
  <p>Works like a charm, but </p>
  
  <pre><code>function checkNull(x, y) {
  if (!x) { x = y; }
  }
  </code></pre>
  
  <p>Doesn't work at all.</p>
  
  <p>What am I doing wrong?</p>