Skip to content

Commit f569591

Browse files
authored
docs: add output comment in Symbols article
1 parent 30a5d5e commit f569591

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

1-js/04-object-basics/08-symbol/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ for (let key in user) alert(key); // name, age (no symbols)
169169
*/!*
170170

171171
// the direct access by the symbol works
172-
alert( "Direct: " + user[id] );
172+
alert( "Direct: " + user[id] ); // Direct: 123
173173
```
174174

175175
[Object.keys(user)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/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.

0 commit comments

Comments
 (0)