变量未定义,或者定义为赋值的情况下 都会是undifine

 1 <!DOCTYPE HTML>
 2 <html>
 3 <head>
 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 5 <title>无标题文档</title>
 6 </head>
 7 
 8 <body>
 9     <script>
10         //真 假
11         var n;
12         alert(typeof(n))
13         if(n){
14             alert('真的')    
15         }else{
16             alert('假的')
17         }
18     </script>
19 </body>
20 </html>
衣带渐宽终不悔,为伊消得人憔悴,憔悴半天也没用,还是努力起来人富贵
原文地址:https://www.cnblogs.com/zhangjingyun/p/4685915.html