We're a place where coders share, stay up-to-date and grow their careers.
Tip: instead of something === undefined && something === null you can write something == null and it matches both undefined and null, and only them.
something === undefined && something === null
something == null
I find it the only valid case to use == over ===.
==
===
True! Thanks!
That's true, but oftentimes you have a linter which forces to use "eqeqeq"
Only if you have had someone strongly opinioned setting it up :) And even then you have the null: ignore option for it.
null: ignore
Tip: instead of
something === undefined && something === null
you can writesomething == null
and it matches both undefined and null, and only them.I find it the only valid case to use
==
over===
.True! Thanks!
That's true, but oftentimes you have a linter which forces to use "eqeqeq"
Only if you have had someone strongly opinioned setting it up :) And even then you have the
null: ignore
option for it.