update: let、const

This commit is contained in:
qianguyihao
2020-07-06 19:11:21 +08:00
parent aac7659854
commit 4eb000322f
5 changed files with 44 additions and 39 deletions

View File

@@ -66,7 +66,7 @@ console.log(c); // 报错Uncaught ReferenceError: c is not defined ==> 找不
报错是因为找不到 b c 这两个变量
### 4同一作用域下var 可以声明同名变量let const 不能声明同名变量
### 4同一作用域下var 可以重复声明变量let const 不能重复声明变量
```js
var a = '我是a';
@@ -86,6 +86,9 @@ const c = 'qianguyihao';
console.log(c); //报错Uncaught SyntaxError: Identifier 'c' has already been declared ==> 变量 c 已经被声明了
```
备注通过第3第4点可以看出使用 let/const
### 5let const 的暂时性死区DTC