Re: get & set
- --- In email@example.com, "douglascrockford" <douglas@...> wrote:
>I use get and set sometimes, I am aware that they are:
> I have been asked to have JSLint always warn on use of get and set.
> How would you feel about that?
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.
Are there any other reasons not to use them besides what I mentioned?