Merge pull request #2783 from akxavier/master
Added link for Object.keys(user)
This commit is contained in:
commit
153fd11a85
1 changed files with 1 additions and 1 deletions
|
@ -161,7 +161,7 @@ for (let key in user) alert(key); // name, age (no symbols)
|
||||||
alert( "Direct: " + user[id] );
|
alert( "Direct: " + user[id] );
|
||||||
```
|
```
|
||||||
|
|
||||||
`Object.keys(user)` also ignores them. That's a part of the general "hiding symbolic properties" principle. If another script or a library loops over our object, it won't unexpectedly access a symbolic property.
|
[Object.keys(user)](mdn:js/Object/keys) also ignores them. That's a part of the general "hiding symbolic properties" principle. If another script or a library loops over our object, it won't unexpectedly access a symbolic property.
|
||||||
|
|
||||||
In contrast, [Object.assign](mdn:js/Object/assign) copies both string and symbol properties:
|
In contrast, [Object.assign](mdn:js/Object/assign) copies both string and symbol properties:
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue