Skip to content

Commit 6496d01

Browse files
committed
docs(object): add object.assign
1 parent b96a3fd commit 6496d01

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

docs/object.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,7 @@ const DEFAULTS = {
559559

560560
function processContent(options) {
561561
options = Object.assign({}, DEFAULTS, options);
562+
console.log(options);
562563
// ...
563564
}
564565
```
@@ -576,6 +577,9 @@ const DEFAULTS = {
576577
};
577578

578579
processContent({ url: {port: 8000} })
580+
// {
581+
// url: {port: 8000}
582+
// }
579583
```
580584

581585
上面代码中,原意是将`url.port`改成8000,`url.host`不变。实际结果却是`options.url`覆盖掉`DEFAULTS.url`,`url.host`不存在了。

0 commit comments

Comments
 (0)