title: What is the reason behind JSLint saying there are "too many var statements"
body: <p>JSLint (with the onevar flag turned on) is flagging some javascript code that I have with the following:</p>
  
  <pre>Problem at line 5 character 15: Too many var statements.</pre>
  
  <p>I am happy to fix these errors, but I'd like to know, am I doing it for performance or because it is just a bad practice and has a greater potential to introduce bugs in my javascript code.  What is the reason behind the onevar flag?</p>
  
  <p>I did look at the JSLint docs for the <a href="http://www.jslint.com/lint.html#var" rel="noreferrer">var keyword</a> but it doesn't specifically talk about why multiple var statements in the same function are bad.</p>
  
  <p>Here is an attempt at an example.  Explain how the code will benefit from only having 1 var statement:</p>
  
  <pre><code>function Test(arg) {
     var x = arg + 1,
         y = cache.GetItem('xyz');
     if (y !== null) {
        // This is what would cause the warning in JSLint
        var request = ajaxPost(/* Parameters here */);
  
     }
  }
  </code></pre>