A shorthand for Object.defineProperty?

Axel Rauschmayer axel at rauschma.de
Mon Jun 20 03:43:36 PDT 2011

Would it make sense to include a shorthand for calling Object.defineProperty() to object literals?

Possible benefits:
- Extensible, should other property attributes come up in the future
- Descriptive
- Might obviate the need to have a shorthand for "enumerable" (I usually ignore it and can’t think of any use cases)

=== Example ===

var Multiplier = {
    FACTOR :: { value: 3, writable: false },
    multiply: function (x) {
        return x * this.FACTOR;

Dr. Axel Rauschmayer

axel at rauschma.de

home: rauschma.de
blog: 2ality.com

More information about the es-discuss mailing list