8.语句.html 538 B

123456789101112131415161718192021222324252627282930
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>Document</title>
  7. </head>
  8. <body>
  9. <!--
  10. -->
  11. <script>
  12. // {
  13. // 代码块
  14. // }
  15. // 全局
  16. var a = 6;
  17. // 局部
  18. function fn1() {
  19. var c = 1;
  20. console.log(c, "c");
  21. console.log(a, "a");
  22. }
  23. fn1();
  24. console.log(a, "a1");
  25. console.log(c, "c1");
  26. </script>
  27. </body>
  28. </html>