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
function notEmpty(value){ return (typeof value !== 'undefined' && value.trim().length); }
it will also check white spaces (' ') along with following: