Absolutely true. I was only referring to the use of the word "insane" which just sounds very unknowing/ignorant to me.
FWIW, now that we use TS for most things, this is not problem for us often, except for when something is nullable ánd multiple types (object/number/string/undefined).
My recommendation is to never use null and only use undefined. Replace your "null"s with an "EMPTY/UN_SET" data type.
Coding since 11yo, that makes it over 30 years now ~~~
Have a PhD in Comp Sci ~~~
Love to go on bike tours ~~~
I try to stay as generalist as I can in this crazy wide place coding is at now.
Fair enough. I didn't mean insane in the sense of completely without reason, just in the sense that it was badly thought out.
The thing is that nulls are now baked into JS at a few levels, so in our own code we can avoid them, but they pop up throughout the various JS apis, eg
That's what I mean by the loose "insane" comment. It was a mistake that was bad enough that as JS devs we're now best off to generally avoid the fundamental null value in JS.
I totally agree with you about TS, which corrects many of these issues, and how in JS we're best to use undefined whereever possible.
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.
Absolutely true. I was only referring to the use of the word "insane" which just sounds very unknowing/ignorant to me.
FWIW, now that we use TS for most things, this is not problem for us often, except for when something is nullable ánd multiple types (object/number/string/undefined).
My recommendation is to never use
null
and only useundefined
. Replace your "null"s with an "EMPTY/UN_SET" data type.Fair enough. I didn't mean insane in the sense of completely without reason, just in the sense that it was badly thought out.
The thing is that nulls are now baked into JS at a few levels, so in our own code we can avoid them, but they pop up throughout the various JS apis, eg
That's what I mean by the loose "insane" comment. It was a mistake that was bad enough that as JS devs we're now best off to generally avoid the fundamental null value in JS.
I totally agree with you about TS, which corrects many of these issues, and how in JS we're best to use
undefined
whereever possible.