Null-coalescing default values in destructuring

Oliver Dunk oliver at
Fri May 10 08:57:57 UTC 2019

> Given input valid JSON JSON.parse() or JSON.stringify() replacer function can be utilized to substitute "undefined" for null.

guest271314, that’s a lot of code! It feels like if anything, your example backs up the proposal.

> `const { z =? 'a' } = { z: null };`

I’m not sure I like the proposed syntax. The question mark indicates to me that it’s the value on the lhs that’s optional - when in reality, it’s the other way around.

More information about the es-discuss mailing list