Simo Costa (2018-12-01T11:09:56.000Z)
@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.


Il giorno sab 1 dic 2018 alle ore 11:13 T.J. Crowder <
tj.crowder at farsightsoftware.com> ha scritto:

> On Fri, Nov 30, 2018 at 5:49 PM T.J. Crowder
> <tj.crowder at farsightsoftware.com> wrote:
>
> > which is
> >
> > ```js
> > class Example {
> >     ...
> > }
>
> Apologies, that "which is" at the end of my previous message should have
> been:
>
> ```js
> class Example {
>     second;
>     #third;
>     fifth;
>     constructor(first, second, third, fourth, fifth) {
>         this.second = second;
>         this.#third = third;
>         this.fifth = fifth;
>         // presumably code here uses `first` and `fourth`
>     }
> }
> ```
>
> Editing error. :-)
>
> -- T.J. Crowder
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20181201/02b91732/attachment-0001.html>
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.