GitHub 博客园 Nanakon

㊣'undefined' 'object' undefined null

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8" />
    <title></title>
</head>
<body>
    <script>
        if (typeof a !== 'undefined' && typeof a.b !== 'undefined') {
        }
        // 报错 typeof a !== 'undefined' &&不会再执行下一条件
        //if (typeof a.b !== 'undefined') {
        //}
        // 报错
        // alert(a);
        // 未声明和已声明未赋值,类型都是'undefined'
        var c;
        console.log(typeof c);
        if (c === undefined) {
        }
        // 报错 未声明
        //if (d === undefined) {
        //}
        var e = null;
        if (typeof e === 'object') {
        }
    </script>
</body>
</html>

 

posted on 2013-01-24 11:39  jzm17173  阅读(144)  评论(0编辑  收藏  举报

导航

轻音