const 定义常量

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>const 定义常量</title>

</head>
<body>

<script>
    //声明常量(要赋值,使用大写,不能修改)
    const SCHOOL = '清华大学';
    console.log(SCHOOL);

    //块作用域
    // {
    //     const SCHOOL = '清华大学';
    // }
    // console.log(SCHOOL);  //错误
</script>
</body>
</html>

相关文章:

  • 2021-06-09
  • 2022-12-23
  • 2021-12-21
  • 2022-01-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-25
  • 2022-12-23
  • 2021-07-20
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案