Loading ...
Sorry, an error occurred while loading the content.

1386Implied global or hoisted var

Expand Messages
  • Bert Belder
    Jul 27, 2010
    • 0 Attachment
      When linting this code:

      (function outer() {
      var foo = function() {

      var bar = function() {


      JSLint gives me these warnings:

      Problem at line 3 character 5: 'bar' is not defined.
      Implied global: bar 3
      Unused variable: bar 1 outer

      I think all three warnings are wrong. Due to type hoisting the 'var bar'
      declaration applies to the entire scope of the 'outer' function, so foo()
      inherits 'bar' from 'outer'.

      Or am I missing something here?

      best regards,
    • Show all 10 messages in this topic