Question: how to check null or undefined in javascript?
Answer: Expression somevar == null will return true for undefined and null , but false for everything else (an error if variable is undeclared). Using the != will flip the result, as expected.