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

Re: saw 'undefined' (a reserved word)

Expand Messages
  • donavon.west
    But the fact remains that undefined is NOT a reserved word yet JSLint erroneously reporting that it is. What I m doing in the example given (which you call
    Message 1 of 7 , Dec 16, 2009
    • 0 Attachment
      But the fact remains that undefined is NOT a reserved word yet JSLint erroneously reporting that it is. What I'm doing in the example given (which you call sloppy code) works perfectly fine, is becoming a common practice and JSLint should allow it.

      If you insist that JSLint call this out, at least change the error message to not state that undefined is a reserved word. I could at least understand and respect that decision.

      Thx,
      Donavon

      BTW, a quick "thx again" for JSLint. I couldn't live without it.


      --- In jslint_com@yahoogroups.com, "Douglas Crockford" <douglas@...> wrote:
      >
      > --- In jslint_com@yahoogroups.com, "donavon.west" <donavonwest@> wrote:
      > >
      > > In JavaScript/ECMAScript, undefined is NOT a reserved word, but I get the error "Expected an identifier and instead saw 'undefined' (a reserved word)" when JSLinting the following code:
      > >
      > > function(window, undefined) {
      >
      > undefined should have been a reserved word. To avoid confusion, it is best to treat it as such.
      >
    • samckayak
      ... Sounds like you use JSLint as a syntax checker. Equally important is JSLint s ability to define a safe, reliable, readable subset of JavaScript.
      Message 2 of 7 , Dec 17, 2009
      • 0 Attachment
        --- In jslint_com@yahoogroups.com, "donavon.west" <donavonwest@...> wrote:
        >
        > But the fact remains that undefined is NOT a reserved word yet JSLint erroneously reporting that it is. What I'm doing in the example given (which you call sloppy code) works perfectly fine, is becoming a common practice and JSLint should allow it.
        >

        Sounds like you use JSLint as a syntax checker. Equally important is JSLint's ability to define a safe, reliable, readable subset of JavaScript. Excluding variable names like "undefined" fits into this category of unsafe practices, like excluding "exec()".
      • donavon.west
        Using undefined in such a way is not even remotely in the same ballpark as using exec(). Again undefined is NOT a reserved word. Keep the in JSLint warning if
        Message 3 of 7 , Dec 17, 2009
        • 0 Attachment
          Using undefined in such a way is not even remotely in the same ballpark as using exec(). Again undefined is NOT a reserved word. Keep the in JSLint warning if you must but at least change the error message. "Eval is evil", I get that. It doesn't say "Eval is not a JavaScript function".

          --- In jslint_com@yahoogroups.com, "samckayak" <samc@...> wrote:
          >
          >
          >
          > --- In jslint_com@yahoogroups.com, "donavon.west" <donavonwest@> wrote:
          > >
          > > But the fact remains that undefined is NOT a reserved word yet JSLint erroneously reporting that it is. What I'm doing in the example given (which you call sloppy code) works perfectly fine, is becoming a common practice and JSLint should allow it.
          > >
          >
          > Sounds like you use JSLint as a syntax checker. Equally important is JSLint's ability to define a safe, reliable, readable subset of JavaScript. Excluding variable names like "undefined" fits into this category of unsafe practices, like excluding "exec()".
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.