Is there a universal JavaScript function that checks that a variable has a value and ensures that it\'s not undefined or null? I\'ve got this code,
undefined
null
This condition check
if (!!foo) { //foo is defined }
is all you need.