minor fixes

This commit is contained in:
Ilya Kantor 2022-04-15 08:11:09 +03:00
parent 9b95054bcd
commit 344c36fa07

View file

@ -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. 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" ````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. 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 ## "Hidden" properties
Symbols allow us to create "hidden" properties of an object, that no other part of code can accidentally access or overwrite. 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. For instance, if we're working with `user` objects, that belong to a third-party code. We'd like to add identifiers to them.