Skip to content

Commit afd7dc6

Browse files
author
pengjie
committed
MOD
1 parent 8176b8a commit afd7dc6

34 files changed

+24750
-2
lines changed

1688.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
1. ES6
2+
1. 箭头函数与function
3+
2. set
4+
- true
5+
3. 新增了哪些特性
6+
2. angular vue 区别
7+
3. vue
8+
1. vDom
9+
- https://segmentfault.com/a/1190000008291645
10+
- https://zhuanlan.zhihu.com/p/27437595
11+
2. 单向数据流
12+
4. 模块化
13+
14+
+ 多看底层/原理

es6/Let,Const.md

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
### LET
2+
3+
#### 不存在变量提升
4+
5+
#### 暂时性死区TDZ
6+
7+
+ 只要块级作用域内存在`let`命令,它所声明的变量就绑定这个区域,不再受外部影响
8+
9+
```javascript
10+
1.
11+
if(true){
12+
tmp = 'abc' //ReferenceError
13+
console.log(temp) //ReferenceError
14+
15+
let temp //TDZ结束
16+
console.log(temp) //undefined
17+
18+
temp = 123
19+
console.log(temp) //123
20+
}
21+
22+
2.
23+
typeof x
24+
let x
25+
26+
3. function(x=y, y=2){} // x=y 时,y还没有声明,报错
27+
28+
4. let x = x // 声明和赋值同时进行
29+
```
30+
31+
#### 不允许重复声明
32+
33+
+ `let`不允许在相同作用域内,重复声明一个相同变量
34+
35+
```javascript
36+
function foo(){
37+
let a = 10
38+
var a = 1
39+
}
40+
41+
// 报错
42+
function foo(){
43+
let a = 10
44+
let a = 1
45+
}
46+
```
47+
48+
#### 块级作用域
49+
50+
```javascript
51+
function f1() {
52+
let n = 5;
53+
if (true) {
54+
let n = 10; // 只在if语句内生效
55+
}
56+
console.log(n); // 5
57+
}
58+
```
59+
60+
+ 可以在块级作用域声明同名函数(但存在兼容性问题)
61+
62+
63+
64+
65+
66+
67+
68+
69+
70+
71+
72+
73+
74+
75+
76+
77+
78+

0 commit comments

Comments
 (0)