add promise queue

This commit is contained in:
Ilya Kantor 2019-03-06 23:27:31 +03:00
parent 1373f6158c
commit 16cfa3037b
27 changed files with 160 additions and 36 deletions

View file

@ -18,7 +18,7 @@ let id = Symbol();
We can also give symbol a description (also called a symbol name), mostly useful for debugging purposes:
```js
```js run
// id is a symbol with the description "id"
let id = Symbol("id");
```
@ -50,6 +50,8 @@ alert(id); // TypeError: Cannot convert a Symbol value to a string
*/!*
```
That's a "language guard" against messing up, because strings and symbols are fundamentally different and should not occasionally convert one into another.
If we really want to show a symbol, we need to call `.toString()` on it, like here:
```js run
let id = Symbol("id");
@ -58,7 +60,14 @@ alert(id.toString()); // Symbol(id), now it works
*/!*
```
That's a "language guard" against messing up, because strings and symbols are fundamentally different and should not occasionally convert one into another.
Or get `symbol.description` property to get the description only:
```js run
let id = Symbol("id");
*!*
alert(id.description); // id
*/!*
```
````
## "Hidden" properties