undefined and null are falsy in javascript but,
var n = null; if(n===false){ console.log(\'null\'); } else{ console.log(\'has value\'); }
b
You can check for falsy values using
var n = null; if (!n) { console.log('null'); } else { console.log('has value'); }
Demo: Fiddle
Or check for truthiness like
var n = null; if (n) { //true if n is truthy console.log('has value'); } else { console.log('null'); }