㊣'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>
原文地址:https://www.cnblogs.com/jzm17173/p/2874610.html