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

939Variable x was used before it was declared.

Expand Messages
  • Toby Maxwell-Lyte
    Oct 1, 2009

      When JSLinting there are several scenarios where we get the "Variable
      {a} was used before it was declared. " message.

      This usually occurs when we define static constants before the constructor. E.g.

      MyClass.CONSTANT = 23;

      function MyClass () {

      MyClass.prototype.myMethod = function () {

      What is the rational behind this check?
      Which of the jslint options disables it?

      I was looking at the documentation page specfically at the undef option.
      undef : true if variables must be declared before used. (more)
      I think that there is a bug with the
      http://www.jslint.com/lint.html#undefined anchor that's linked to from
      the (more) link.

      Many thanks,
    • Show all 9 messages in this topic