Recently I came across this statement
if (val != 'undefined' && val != null && val != 'null') { //some statements }
undefined and null are simple types and not literal strings!
alert(null === ‘null’); will return false so will alert(undefined === ‘undefined’);
So the statement should be:
if (val !== undefined && val !== null) { //some statements }