Check for truthy/falsy values instead of checking for null
Replace check against undefined with a check for a falsy value