<script> let a=xxx; if (!a && typeof a=="object") { alert('a是一個null'); }else if(!a && typeof a=="undefined"){ alert('a是undefined') }else if(!a && typeof a=='string'){ alert('a是一個空字符串') }else{ alert('其它') } </script>