We are frequently using the following code pattern in our JavaScript code
if (typeof(some_variable) != \'undefined\' && some_variable != null) {
whatever yyy is undefined or null, it will return true
if (typeof yyy == 'undefined' || !yyy) { console.log('yes'); } else { console.log('no'); }
yes
if (!(typeof yyy == 'undefined' || !yyy)) { console.log('yes'); } else { console.log('no'); }
no