title: Why does JSLint complain about undefined/implied global variable?
body: <p>I'm trying to understand why JSLint complains about an implied global variable in the following example:</p>
  
  <pre><code>var TEST = (function () {
    var count = 0;
  
    function get_count() { 
      return add_one(); 
    }
  
    function add_one() {
      count += 1;
      return count;
    }
  
    return { 
      get_count: get_count
    };
  }());
  </code></pre>
  
  <p>Running this through JSLint gives the error:  </p>
  
  <blockquote>
    <p>Problem at line 5 character 12: 'add_one' is not defined.</p>
  </blockquote>
  
  <p>As well as saying:  </p>
  
  <blockquote>
    <p>Implied global: add_one 5</p>
  </blockquote>
  
  <p>If you move the <code>add_one()</code> function before the <code>get_count()</code> function the error goes away.  However with the code as it is above, it doesn't produce any errors when you run it in the browser.  Can anyone explain why JSLint is complaining?</p>
  
  <p>Thanks!<br>
  Matt</p>