if (variable !== null) {
//code
}
//Or, if you're expecting null as a string ('null'):
if (variable != null) {
//code
}
//!== means not equal to, just like !=, but !== checks that the datatype is the same, whereas != doesn't.
//Example: (null !== "null") = true (null != "null") = false