显性布尔类型转换:
<script> //显示转换布尔类型 let num = 0; console.log(typeof num); //一个!是非,分2步,先转换成布尔类型,再取反 //两个!!转换完后,0是布尔类型的false,取反再取反 //也就是false num = !!num; console.log(typeof num); console.log(num); </script>