|
|
|
|
|
by hn_throwaway_99
1705 days ago
|
|
> I have only seen null vs undefined lead to 2 things in my experience: mistakes and bikeshedding. I disagree, though I think the implementation leaves something to be desired. Primarily, I think there is fundamentally a difference between the value of obj.bar in the following examples that is useful to differentiate between: { foo: 'hello' } { foo: 'hello', bar: null } For example, GraphQL makes specific use of this when dealing with input types for mutations: null essentially means "delete this field" while unset means "don't change it". There is a very good discussion on this topic here, https://github.com/graphql/graphql-js/issues/133 , which goes into the rationale behind it, how it's supported in languages that do NOT differentiate between null and undefined, and how some folks changed their minds on the issue. |
|