4_变量特性.html 645 B

12345678910111213141516171819202122232425262728
  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. <script>
  10. // 变量特性:随意转换变量类型
  11. var a = 10;
  12. a = "hello";
  13. console.log(a);
  14. //变量特性:重复定义
  15. var a = "world";
  16. console.log(a);
  17. //变量特性:可以不定义直接使用 赋值操作
  18. b = "abc";
  19. console.log(b);
  20. //变量特性:可以定义不赋值
  21. var c;
  22. console.log(c);
  23. </script>
  24. </body>
  25. </html>