--

Hello Markus and Jovica!

I get your points, and I admit that the examples are not the same.

I do however think that the behavior of both default parameters and defaults in destructuring behave correctly. Undefined means just that, that the value is not yet set, not defined. But null is a set value and should not trigger defaults. I think we use them too similarly in our code, not clarifying in use that they have two different meanings.

--

--

Esbjörn Blomquist
Esbjörn Blomquist

Written by Esbjörn Blomquist

Software architect and developer with web and functional JavaScript close to his heart. Worked many years with web solutions mainly within the IoT field.

No responses yet