JS Dasar: 63. Strict mode

by istiq20

HTML

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Strict mode</title>
  </head>
  <body>
    <script>
      function useStrictMode() {
        "use strict";
        const person = {
          firstName: "Eko",
        };

        // error 
        with (person) {
          console.info(firstName);
        }
      }

      useStrictMode(); // SyntaxError: Strict mode code may not include a with statement
    </script>
  </body>
</html>