每次都忘記
紀錄一下
var a =null; // a is not true //a is not "char" // a is undefined
var b= ''; // b is not true // b is not null // b is not undefined
var c ='test'; //c ok //c is not null //c is not undefined //c is not empty char
var d = undefined; // d is not true // d is not "char" // d is null
if(d) { alert('d OK'); }
if(!d) { alert('d is not true') };
if(d==""){ alert('d is empty char ')};
if(d!=""){ alert('d is not empty char ')}
if(d==null) { alert('d is null ') };
if(d!=null){ alert('d is not null ') };
// d is not true
// d is not empty char
// d is null
if(a) { alert('a OK'); }
if(!a) { alert('a is not true') };
if(a==""){ alert('a is empty char ')};
if(a!=""){ alert('a is not empty char ')}
if(a==undefined) { alert('a is undefined') };
if(a!=undefined){ alert('a is not undefined') };
// a is not true
//a is not empty char
// a is undefined
if(b) { alert('b OK'); }
if(!b) { alert('b is not true') };
if(b==null){ alert('a is null ')};
if(b!=null){ alert('a is not null ')}
if(b==undefined) { alert('a is undefined') };
if(b!=undefined){ alert('a is not undefined') };
// b is not true
// b is not null
// b is not undefined
if(c){ alert('c ok');}
if(!c){alert('c is not true')};
if(c==null){alert('c is null')}
if(c!=null){alert('c is not null ')}
if(c==undefined){alert('c is undefined ')}
if(c!=undefined){ alert('c is not undefined ')}
if(c==""){alert('c is empty char ')}
if(c!=""){ alert('c is not empty char ')}
//c ok
//c is not null
//c is not undefined
//c is not empty char