hasValue
JavaScript
function hasValue(val) {
var result = (!!val && typeof val != 'undefinded');
return result;
}
var a = 10;
var b;
var c = null;
var d = undefined;
console.log('a = ' + hasValue(a));
console.log('b = ' + hasValue(b));
console.log('c = ' + hasValue(c));
console.log('d = ' + hasValue(d));