<script type="text/javascript">
var num;
if (num === undefined) {
alert("num is undefined1")
}
if (num == undefined) {
alert("num is undefined3")
}
if (typeof (num) == "undefined") {
alert("num is undefined2")
}
//如果num被声明但是未赋值,三种判断方法均有效
//如果num未被声明,前两个判断方法会报错,方法三依然有效
//所以 判断undefined推荐使用方法三
</script>