Strict Mode tutorial in Advance JavaScript

 <!DOCTYPE html>

<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>String Mode Advance JavaScript</title>
    <link rel="stylesheet" href="">
</head>

<body>
    <script>
        // NOTE: WHEN WE USE JAVASCRIPT CODE THEN IT IS GOOD PRACTICE TO USE "use strict" AT THE STARTING OF CODE.
        "use strict";
        // Example 1 :
        // "use strict";
        // a = 10;
        // console.log(a);

        // Example 2 :
        // "use strict";
        // function test() {
        //     // "use strict"; //We can write "use strict" here also
        //     b = 20;
        // }
        // test();

        // Example 3 :
        //Here below, If we don't use "use strict", then output is not correct because we have used duplicate parameter name
        "use strict";
        function test(a, b, b) {
            console.log(a + b + b);
        }
        test(10, 20, 30);

    </script>
</body>

</html>

Comments

Popular posts from this blog

Generators tutorial in Advance JavaScript

Document Object Module DOM querySelector and querySelectorAll tutorial in JavaScript

Find Even and Odd Numbers with Loops tutorial in JavaScript