null, undefined, ""在強制型轉後會成為false
可利用這個特性來判斷變數是否存在
var a; // goes to internet and looks for a value if (a || a === 0) { console.log('Something is there.'); }
Last updated 4 years ago
Was this helpful?