1
0
mirror of https://github.com/ruanyf/es6tutorial.git synced 2025-05-26 03:32:20 +00:00

Merge pull request #840 from bigbird231/patch-2

update object.md
This commit is contained in:
Ruan YiFeng 2019-04-10 11:56:41 +08:00 committed by GitHub
commit 03695be2db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -473,8 +473,8 @@ z // { a: 3, b: 4 }
由于解构赋值要求等号右边是一个对象,所以如果等号右边是`undefined``null`,就会报错,因为它们无法转为对象。
```javascript
let { x, y, ...z } = null; // 运行时错误
let { x, y, ...z } = undefined; // 运行时错误
let { ...z } = null; // 运行时错误
let { ...z } = undefined; // 运行时错误
```
解构赋值必须是最后一个参数,否则会报错。