es6笔记3_const声明常量及其特点
程序员文章站
2022-07-16 22:04:56
...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
</style>
</head>
<body>
<script>
//声明常量
const name='xxx'
//1.一定要幅初始值。2.一般常量使用大写。3.值不能修改
//4.块级作用域
// {
// const player='uzi'
// }
// console.log(player)//player is not defined
//5.对于数组和对象的元素修改,不算做对常量的修改,不会报错
const TEAM=['uzi','mlxg','ming','letme']
TEAM.push('meiko')
</script>
</body>
</html>
上一篇: promise的基本用法
推荐阅读