Darien Valentine (2018-07-05T00:16:47.000Z)
valentinium at gmail.com (2018-07-05T00:18:41.481Z)
> My thought was to have the following: this.foo ?= params?.foo; which can be desugared to if (($ref = params?.foo) !== undefined) { this.foo = $ref; } Are there any specific advantages to the new syntax you’re describing? Initially, it appears to me like a less powerful form of an existing syntactic feature — default initializers and binding patterns allow expressing the same logic: ``` const obj = { demo(params={}) { ({ foo: this.foo=this.foo } = params); console.log( `params was ${ JSON.stringify(params) }; ` + `this.foo is now ${ JSON.stringify(this.foo) }` ); } } obj.demo({ foo: 1 }); obj.demo({}) obj.demo({ foo: 2 }); obj.demo(); obj.demo({ foo: 3 }); obj.demo({}); ```