Javascript Chp 2, let const var

 <!DOCTYPE html>

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
   
    <script>

        var b = 60;
        var x = ++b;
       
        console.log(x);
        // var can be change any where any time but the let works inside the block
        {
            var x = ++b;
            console.log(x);
            document.write(x);
        }
        {
            var a = "I'm your biggest fan";
            console.log(a);
        }

        var a = "Who you think you are ?";
        console.log(a);
    </script>
</body>
</html>

Comments