Why are non-method properties in a prototype an anti-pattern?

Kevin Smith khs4473 at gmail.com
Wed Nov 7 09:27:53 PST 2012


>
>
> Any other reasons for why they are discouraged?
>

This footgun:

    function MyClass() {

      this.value = 1;  // OK
      this.list.push(0);  // Modifying the list for every instance -
probably not intended.
    }

    MyClass.prototype.value = 0;
    MyClass.prototype.list = [];

- Kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121107/bb4d97c6/attachment.html>


More information about the es-discuss mailing list