DEV Community

Discussion on: undefined and null in JavaScript Explained

Collapse
 
zimlearn profile image
Dr Abstract

Any idea why they made null not work to trigger the default parameter value? I guess it is handy if you really want that parameter to have a null value rather than the default. I don't recall ever needing that... but this way there is a choice. It is just sort of annoying after years of typing null in for a default parameter we have to type undefined. That is twice as much typing. Kind of wished they went the other way - pass an undefined in to keep the parameter undefined. Pass a null in to trigger the default parameter. Whatever - too late now.