Skip to content

Commit 3c60401

Browse files
author
yibuyisheng
committed
3.2
1 parent e94d22e commit 3c60401

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

md/3.2.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
## 3.2 严格模式与 ECMAScript 6
2+
3+
ECMAScript 5 引入严格模式来清理语言,在文件或者函数的第一行放入下面的内容就可以开启严格模式:
4+
5+
```js
6+
'use strict';
7+
```
8+
9+
严格模式引入了三种破坏性的改变:
10+
11+
* 语法改变:一些之前合法的语法在严格模式下面是不允许的。例如:
12+
* 禁止 `with` 语句。它允许使用者添加任何对象到变量作用域链,这会减缓程序的执行速度,并且很难指出某个变量指向哪里。
13+
* 删除一个独立的标识符(一个变量,而不是一个属性)是不允许的。
14+
* 函数只能在作用域的顶层声明。
15+
* 更多的保留字: implements interface let package private protected public static yield 。
16+

md/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* 2.11 [在哪里可以找到更多的 ES6 资源?](./2.11.md)
3232
* 3 [一个 JavaScript : 在 ECMAScript 6 中避免版本化](./3.md)
3333
* 3.1 [版本化](./3.1.md)
34-
* 3.2 严格模式与 ECMAScript 6
34+
* 3.2 [严格模式与 ECMAScript 6](./3.2.md)
3535
* 3.3 结论
3636
* 3.4 深入阅读
3737
* 4 进入 ECMAScript 6 开发

0 commit comments

Comments
 (0)