JS变量提升1

undefined

<!--@description-->
<!--@author beyondx-->
<!--@date Created in 2022/07/30/ 22:24-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <script>
        console.log(a);
        var a = 2;
    </script>
</body>
</html>

not defined

<body>
    <script>
        console.log(a);
        // var a = 2;
    </script>
</body>

posted on 2022-07-30 22:44  beyondx  阅读(3)  评论(0编辑  收藏  举报

导航