总是使用false、零值、null、undefined和空字符串进行比较。但是在使用的时候,需要额外注意。
类型 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
<script type="text/javascript">
console.log(typeof(false)); // boolean
console.log(typeof(0)); // number
console.log(typeof(null)); // object
console.log(typeof(undefined)); // undefined
console.log(typeof("")); // string
</script>