<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<script type="text/javascript">
/*
Null类型的值只有一个,就是null
null这个值专门用来表示一个为空的对象
使用typeof检查一个null值时,会返回object
Undefined类型的值只有一个,就是undefined
当声明一个变量,但是没有给变量赋值时,他就是undefined
使用typeof检查一个undefined值时,会返回undefined
*/
var a = null;
var b;
console.log(typeof a);
console.log(b);
</script>
</head>
<body>
</body>
</html>
9. Null和Undefined
最新推荐文章于 2024-07-22 15:13:59 发布