You misunderstood my point; both null and undefined are not at all arbitrarily defined; what is arbitrary is exactly having two of them.
If you're going to distinguish non-values of different kinds, why only two? Why not add a third one for "no selection", or a NaN-like value for "unknown" values? And I'm sure many problem domains would come up with their own non-values that make absolute sense to distinguish from nullandundefined.
As I said, at that point a more elegant solution would be adding FalseySymbol or NullishSymbol or both and leave it up for the user to define specific non-values that hold whatever semantic meaning they want.
Some comments have been hidden by the post's author - find out more
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
You misunderstood my point; both
nullandundefinedare not at all arbitrarily defined; what is arbitrary is exactly having two of them.If you're going to distinguish non-values of different kinds, why only two? Why not add a third one for "no selection", or a NaN-like value for "unknown" values? And I'm sure many problem domains would come up with their own non-values that make absolute sense to distinguish from
nullandundefined.As I said, at that point a more elegant solution would be adding
FalseySymbolorNullishSymbolor both and leave it up for the user to define specific non-values that hold whatever semantic meaning they want.