minor fixes
This commit is contained in:
parent
9b95054bcd
commit
344c36fa07
1 changed files with 3 additions and 0 deletions
|
@ -44,6 +44,8 @@ alert(id1 == id2); // false
|
|||
|
||||
If you are familiar with Ruby or another language that also has some sort of "symbols" -- please don't be misguided. JavaScript symbols are different.
|
||||
|
||||
To summarize, symbols are "special unique values" with optional description. Let's see where we can use them.
|
||||
|
||||
````warn header="Symbols don't auto-convert to a string"
|
||||
Most values in JavaScript support implicit conversion to a string. For instance, we can `alert` almost any value, and it will work. Symbols are special. They don't auto-convert.
|
||||
|
||||
|
@ -80,6 +82,7 @@ alert(id.description); // id
|
|||
|
||||
## "Hidden" properties
|
||||
|
||||
|
||||
Symbols allow us to create "hidden" properties of an object, that no other part of code can accidentally access or overwrite.
|
||||
|
||||
For instance, if we're working with `user` objects, that belong to a third-party code. We'd like to add identifiers to them.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue