Skip to content

Commit 58ac33f

Browse files
committed
defineVar__let声明变量
1 parent 81c9a5f commit 58ac33f

File tree

3 files changed

+49
-2
lines changed

3 files changed

+49
-2
lines changed

.idea/dataSources/4f943de0-2dbf-4faa-96a3-3cad0127a103.xml

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

es6/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11

22
# [es6](../README.md)
33

4+
- [x] [defineVar__let声明变量](defineVar.html)
5+
46
- [x] [let_var__let和var区别](let_var.html)
57
- [x] [const__模板字符串](const.html)
68
- [x] [const2__字符串反引号](const2.html)

es6/defineVar.html

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<!--
2+
* @由于个人水平有限, 难免有些错误, 还请指点:
3+
* @Author: cpu_code
4+
* @Date: 2021-04-14 12:12:37
5+
* @LastEditTime: 2021-04-14 12:16:11
6+
* @FilePath: \es6\defineVar.html
7+
* @Gitee: [https://gitee.com/cpu_code](https://gitee.com/cpu_code)
8+
* @Github: [https://github.com/CPU-Code](https://github.com/CPU-Code)
9+
* @CSDN: [https://blog.csdn.net/qq_44226094](https://blog.csdn.net/qq_44226094)
10+
* @Gitbook: [https://923992029.gitbook.io/cpucode/](https://923992029.gitbook.io/cpucode/)
11+
-->
12+
13+
<!DOCTYPE html>
14+
<html lang="en">
15+
<head>
16+
<meta charset="UTF-8">
17+
<title>es6 测试</title>
18+
19+
</head>
20+
<body>
21+
<script>
22+
// var 声明的变量没有局部作用域
23+
// let 声明的变量 有局部作用域
24+
{
25+
var a = 1;
26+
let b = 2;
27+
}
28+
29+
console.log(a)
30+
console.log(b)
31+
32+
// var 可以声明多次
33+
// let 只能声明一次
34+
var m = 1;
35+
var m = 2;
36+
37+
let n = 10;
38+
let n = 20;
39+
40+
console.log(m)
41+
console.log(n)
42+
43+
44+
</script>
45+
</body>
46+
</html>

0 commit comments

Comments
 (0)