<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <!-- 
        undefined和null的区别?
        undefiend是定义了未赋值,而null是未定义
     -->
</body>
<script>
    // 我们所认识的
    function getValue(any) {
        if (any) {
            var val = ‘blue‘;
            // 其他代码
            return val;
        } else {
            console.log(val)
                // value值可以在此访问,值为undefined
            return null;
        }
        // value值在此处也可以访问,值为undefined
    }
    getValue();
    // Js引擎所认识的
    function getValues(anys) {
        var val;
        if (anys) {
            val = ‘blue‘;
            // 其它代码
            return value;
        } else {
            return null;
        }
    }
    // 我们以为的var的作用域只限于那一块作用域内,实际上它已经跨越了“{}”界限。
    // val变量的声明被提升到了函数顶部,初始化工作区域还保留在原区域。
    // val变量也是可访问的,此处它的值会是undefined,因为它没有被初始化。
</script>
</html>