1. You should always default to using === in JavaScript. One specific exception where it doesn't matter: Null comparison
2. "myVar == null"
There's no reason to use === as there's no coercion to null. Null is falsey, but it's not loosely equal to any other falsey value the way the other falsey values can be.
There's no reason to use === as there's no coercion to null. Null is falsey, but it's not loosely equal to any other falsey value the way the other falsey values can be.
3. The only thing null is loosely equal to is undefined and itself.
So while this will return true due to coercion:
0 == false
This won't:
null == false
So while this will return true due to coercion:
0 == false
This won't:
null == false
4. But this will return true
null == undefined
while this returns false
null === undefined
null == undefined
while this returns false
null === undefined
5. All that said, using === is still ok because it's just the same as ==. So for most programming defaulting to === even with null comparisons is fine
6. You may want to also use == because you want to force coercion, say to a truthy or falsey value, but in that case, it's important to understand that null (and also undefined) doesn't coerce to false when using ==
7. which is why it's always best when looking for truthy/falsey coercion, to use !! as that will cause the coercion to happen. So this returns true:
!!null === !!undefined
!!null === !!undefined