1if (myVariable === undefined)
This is probably the most frequent mistake I see. While this catches undefined properly, it doesn't guard against reference errors when myVariable is
null. Unless you're explicitly trying to exclude null from your check, this will result in a null reference error if you try to access a property on myVariable.
1if(myVariable === null)
I don't see this as often, but it does happen. While this catches
null properly, it does guard against reference errors when myVariable is undefined.
This check works fine if you don't want your logic to execute when you have
false, zero (integer value), or empty string. The last two are sometimes overlooked as you may want your logic to execute when you have a zero or an empty string.
1if(myVariable == null)
If you're looking to checking for