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