title: How do I set up "var count" so that it is initialized the first time and then incremented?
body: <p>I tried <a href="http://jsfiddle.net/8xPDE/" rel="nofollow">this</a>:</p>
  
  <pre><code>var count;
  
  function testCount ()
  {
    if (count)
    {
      alert("count is: " + count);
      count++;
    }    
    else
    {    
      alert("count is: " + count);
      var count = 0;
    }
  };
  
  testCount();
  </code></pre>
  
  <p>but it always gives "undefined" and the value of count is not updated when I run it again in jsfiddle.</p>