Ok, so I installed Linter on my Sublime editor while working on my node.js app. One of the things that it caught said that I should always use !== to compare an object to null (I usually use != ).
So I changed it...but then I noticed that the !== wasn't working.
UPDATE Ok, so it may be a bit more complicated than I originally thought. In my real code I was using !== with the node.js GLOBAL object.
console.log('Global User: ' + GLOBAL.User);
if (GLOBAL.User != null)
{
console.log('User is not null');
}
The console line prints even when GLOBAL.User is null...
Perhaps this object is special?
Ok, so after reading through the comments and looking at my code, I have learned that !== can have issues if the object is undefined rather than null (see this post: Why is null an object and what's the difference between null and undefined?).
So in my case, my global variable could be, depending on when this method is called, undefined, null, or full of data. I am going to go back and update my code so that it is never undefined and then !== will work consistently.