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

Re: get & set

Expand Messages
  • rodobrist
    ... I use get and set sometimes, I am aware that they are: 1. Not overly performant (js perf type diagnostics). 2. Not compatible in IE
    Message 1 of 3 , Mar 27, 2013
    View Source
    • 0 Attachment
      --- In jslint_com@yahoogroups.com, "douglascrockford" <douglas@...> wrote:
      >
      > I have been asked to have JSLint always warn on use of get and set.
      > How would you feel about that?
      >

      I use get and set sometimes, I am aware that they are:

      1. Not overly performant (js perf type diagnostics).
      2. Not compatible in IE < 9 browsers.

      But in some circumstances they seem more suitable then the alternative of calling getProperty() and setProperty() (es3 attempt of getter/setter).

      These circumstances are:
      1. Chrome extension development
      2. Node js
      3. Working for lovely bosses who tell you they don't care about IE8

      I think es5 getter/setter are cleaner when used correctly.

      Property access was built into the syntax of javascript, I prefer to keep it that way:

      object.property
      vs
      object.callFuncToGetProperty()


      Are there any other reasons not to use them besides what I mentioned?
    Your message has been successfully submitted and would be delivered to recipients shortly.