<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>js空对象undefined测试</title>
<script type="text/javascript">
var persion = new Object();
persion.name = "王总";
alert(persion.name + "," + persion.age + "," + (persion.age == "undefined") + "," + (persion.age == undefined));
//王总,undefined,false,true
if(persion.age) {
alert(1)
} else {
alert(2)//2
}
</script>
</head>
<body>
从测试结果来看,“undefined”不等于undefined
</body>
</html>