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

JSLint does not understand getters and setters.

Expand Messages
  • pauanyu
    var foo = { get bar() {}, set bar(value) {} }; The above fails with the following errors: Problem at line 2 character 9: Expected : and instead saw bar .
    Message 1 of 2 , Oct 6, 2009
    • 0 Attachment
      var foo = {
      get bar() {},
      set bar(value) {}
      };

      The above fails with the following errors:

      Problem at line 2 character 9: Expected ':' and instead saw 'bar'.
      Problem at line 2 character 12: Missing space after 'bar'.
      Problem at line 2 character 13: Expected an identifier and instead saw ')'.
      Problem at line 2 character 13: Stopping, unable to continue. (50% scanned).
    • Douglas Crockford
      ... In a couple of years, I may add an option to accept this. But since it produces a violent syntax error in most current browsers, it is too great a hazard.
      Message 2 of 2 , Oct 6, 2009
      • 0 Attachment
        --- In jslint_com@yahoogroups.com, "pauanyu" <pcxunlimited@...> wrote:
        >
        > var foo = {
        > get bar() {},
        > set bar(value) {}
        > };
        >
        > The above fails with the following errors:
        >
        > Problem at line 2 character 9: Expected ':' and instead saw 'bar'.
        > Problem at line 2 character 12: Missing space after 'bar'.
        > Problem at line 2 character 13: Expected an identifier and instead saw ')'.
        > Problem at line 2 character 13: Stopping, unable to continue. (50% scanned).


        In a couple of years, I may add an option to accept this. But since it produces a violent syntax error in most current browsers, it is too great a hazard.
      Your message has been successfully submitted and would be delivered to recipients shortly.