Simo Costa (2018-12-01T11:09:56.000Z)
andrysimo1997 at gmail.com (2018-12-01T11:11:44.085Z)
@T.J. Crowder No problems for the error :P. Anyway I know Typescript's approach but I prefer something like: ```js class Example { constructor(this.{foo, #bar}) { } showFoo() { console.log(this.foo); } showBar() { console.log(this.#bar); } } const e1 = new Example("answer", 42); e1.showFoo(); // "answer" e1.showBar(); // 42 ``` To both declare, if not already declared, and initialize public and private properties.
andrysimo1997 at gmail.com (2018-12-01T11:11:13.191Z)
@T.J. Crowder No problems for the error :P. Anyway I know Typescript's approach but I prefer something like: ```js class Example { constructor(this.{foo, #bar}) { } showFoo() { console.log(e1.foo); } showBar() { console.log(e1.#bar); } } const e1 = new Example("answer", 42); e1.showFoo(); // "answer" e1.showBar(); // 42 ``` To both declare, if not already declared, and initialize public and private properties.