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

Re: Object getter with setter

Expand Messages
  • douglascrockford
    ... Good practice says to define them in pairs. Be explicit about the failure case.
    Message 1 of 2 , Mar 27 5:46 AM
    • 0 Attachment
      --- In jslint_com@yahoogroups.com, "marcos.zanona" <marcos@...> wrote:
      >
      > It seems when defining:
      >
      > /*jslint es5:true*/
      > a = {
      > get b () { return 'b value'; }
      > }
      >
      > JSLint requires that a setter is also declared, although if the intention is defining a read-only property this might not be ideal?
      >
      > Is there a reason for setters being compulsory in such cases?

      Good practice says to define them in pairs. Be explicit about the failure case.
    Your message has been successfully submitted and would be delivered to recipients shortly.