1
0
mirror of https://github.com/ruanyf/es6tutorial.git synced 2025-05-25 19:22:21 +00:00

Merge pull request #697 from snow212-cn/patch-2

Update object.md
This commit is contained in:
Ruan YiFeng 2018-06-08 07:53:19 +08:00 committed by GitHub
commit 06fac98bb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1426,8 +1426,6 @@ let newVersion = {
```javascript
let aWithDefaults = { x: 1, y: 2, ...a };
// 等同于
even if property keys dont clash, because objects record insertion order:
let aWithDefaults = Object.assign({}, { x: 1, y: 2 }, a);
// 等同于
let aWithDefaults = Object.assign({ x: 1, y: 2 }, a);
@ -1447,8 +1445,6 @@ const obj = {
```javascript
{...{}, a: 1}
// { a: 1 }
even if property keys dont clash, because objects record insertion order:
```
如果扩展运算符的参数是`null``undefined`,这两个值会被忽略,不会报错。