Editor Arrow Download Open
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>JavaScript strict mode enable globally</title> </head> <body> <pre> <!-- Use pre element for work document.writeln() method --> <script type="text/javascript"> "use strict"; var var1 = 10; // works document.writeln(var1); function myFun(){ "use strict"; var var2 = 15; // works document.writeln(var2); } myFun(); // Remove below comments and run it again it will throw syntax error // var3 = 10; // undefined document.writeln(var3); </script> </pre> </body> </html>
  Preview Arrow