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

1795Bad variable names

Expand Messages
  • Ezequiel
    Jan 23, 2011
    • 0 Attachment
      For example, someone could innocently do:

      (function () {
      var String = 'cool story, bro';

      // Later in our program...
      if (!String.prototype.trim) {
      // ...
      }
      }());

      JSLint says this is fine. However, this snippet will produce an error because we chose to name our variable "String," and now String.prototype is totally inaccessible. It would be nice if we were warned because of this.
    • Show all 9 messages in this topic