Proposal: Concise instance initialisation

Sean Eagan seaneagan1 at gmail.com
Tue May 24 07:07:33 PDT 2011


On Tue, May 24, 2011 at 9:02 AM, Sean Eagan <seaneagan1 at gmail.com> wrote:
> // ->
>
> function A (){
>  var a = arguments[0];
>  Object.defineProperty(this, "b", {configurable: false, enumerable:
> false, writable: true, arguments[1]})
>  Object.defineProperty(this, "c", {configurable: true, enumerable:
> true, writable: false, arguments[2]})
>  foo(a);
> }

Sorry, that should have been:

function A (){
 var a = arguments[0];
 Object.defineProperty(this, "b", {configurable: false, enumerable:
false, writable: true, value: arguments[1]})
 Object.defineProperty(this, "c", {configurable: true, enumerable:
true, writable: false, value: arguments[2]})
 foo(a);
}

Cheers,
Sean Eagan


More information about the es-discuss mailing list