首页 > Web开发 > 详细

JS基础_Null和Undefined

时间:2017-07-23 16:18:06      阅读:241      评论:0      收藏:0      [点我收藏+]
 1 <!DOCTYPE html>
 2 <html>
 3     <head>
 4         <meta charset="UTF-8">
 5         <title></title>
 6         <script type="text/javascript">
 7             
 8             /*
 9              * Null(空值)类型的值只有一个,就是null
10              *     null这个值专门用来表示一个为空的对象
11              *     使用typeof检查一个null值时,会返回object
12              * 
13              * Undefined(未定义)类型的值只有一个,就undefind
14              *     当声明一个变量,但是并不给变量赋值时,它的值就是undefined
15              *     使用typeof检查一个undefined时也会返回undefined
16              */
17             var a = null;
18             console.log(typeof a); //object
19             
20             var b = undefined;
21             console.log(typeof b); //undefined
22             
23         </script>
24     </head>
25     <body>
26     </body>
27 </html>

 

JS基础_Null和Undefined

原文:http://www.cnblogs.com/ZHOUVIP/p/7224845.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!