“As much as I’d love our code to be fully compliant with the great programming practices of this world, I’d rather have it working — if possible before the heat death of the Universe.”
Only case where I like to use type coercion is with null.
There are only two values that == null : null and undefined. Same thing for undefined. So it's very useful for when you want to check if your variable holds an actual value and want to avoid an ugly (variable === null || variable === undefined), just do variable == null.
Only case where I like to use type coercion is with null.
There are only two values that
== null
:null
andundefined
. Same thing forundefined
. So it's very useful for when you want to check if your variable holds an actual value and want to avoid an ugly(variable === null || variable === undefined)
, just dovariable == null
.nice tip @elarcis