Cyril Auburtin (2019-05-02T08:22:41.000Z)
Similarly to

```js
const { x = 'a' } = {}; // z === 'a'
const { y = 'a' } = { y: undefined }; // z === 'a'
const { z = 'a' } = { z: null }; // z === null
```
I'd like to propose

```js
const { x =? 'a' } = {}; // z === 'a'
const { y =? 'a' } = { y: undefined }; // z === 'a'
const { z =? 'a' } = { z: null }; // z === 'a'
```
Which would handle also null values in default cases

This is because default destructuring introduced in ES6 doesn't handle null
values, null values in JSON are quite common from APIs, it'd be convenient

It's also inspired by the null-coalescing operator
https://github.com/tc39/proposal-nullish-coalescing
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20190502/8b6cc7e1/attachment.html>
cyril.auburtin at gmail.com (2019-05-02T08:30:37.046Z)
Similarly to

```js
const { x = 'a' } = {}; // z === 'a'
const { y = 'a' } = { y: undefined }; // z === 'a'
const { z = 'a' } = { z: null }; // z === null
```
I'd like to propose

```js
const { x =? 'a' } = {}; // z === 'a'
const { y =? 'a' } = { y: undefined }; // z === 'a'
const { z =? 'a' } = { z: null }; // z === 'a'
```
Which would handle also null values in default cases

This is because default destructuring introduced in ES6 doesn't handle null
values, null values in JSON are quite common from APIs, it'd be convenient

It's also inspired by the null-coalescing operator
https://github.com/tc39/proposal-nullish-coalescing