We are frequently using the following code pattern in our JavaScript code
if (typeof(some_variable) != \'undefined\' && some_variable != null) {
In ES5 or ES6 if you need check it several times you cand do:
const excluded = [null, undefined, '']; if (!exluded.includes(varToCheck) { // it will bee not null, not undefined and not void string }