Re: Extending Object

2016-04-23 Thread Allen Wirfs-Brock
On Apr 23, 2016 6:15 PM, /#!/JoePea wrote: > > Are the following examples the same? No. Consider the value of (new Foo).assign For the two alternatives ___ es-discuss mailing list es-discuss@mozilla.org

RE: Extending Object

2016-04-23 Thread Oriol Bugzilla
); // Object.prototype ``` You are able to shadow or replace `Object` with a custom constructor. And this constructor might use `this`, that's why `super()` is required. > From: j...@trusktr.io > Date: Sat, 23 Apr 2016 18:15:28 -0700 > Subject: Extending Object > To: es-discuss

Extending Object

2016-04-23 Thread /#!/JoePea
Are the following examples the same? Is there any reason to extend Object manually? ```js class Foo { constructor() {} } new Foo ``` ```js class Foo extends Object { constructor() { super() } // super() is required. } new Foo ``` ___ es-discuss

Re: Extending object literal property value shorthand

2015-03-25 Thread Rick Waldron
Inline... On Wed, Mar 25, 2015 at 12:25 AM Bob Myers r...@gol.com wrote: Thanks Rick. Yes, I had been hoping to make the following work: x = {a: 1}; y = {b: 2}; z = {x.a, b.y}; // {a: 1, b: 2} This is not destructuring per se. Of course, and that's not what I was exploring in attempting

Extending object literal property value shorthand

2015-03-24 Thread Bob Myers
Thanks Rick. Yes, I had been hoping to make the following work: x = {a: 1}; y = {b: 2}; z = {x.a, b.y}; // {a: 1, b: 2} This is not destructuring per se. It's an extension to object literal property value shorthand syntax. The idea was to derive the desired property name `a` from `x.a`. This