fix missed line breaks
This commit is contained in:
parent
6e515742e5
commit
39aca70984
1 changed files with 2 additions and 0 deletions
|
@ -53,6 +53,7 @@ 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 accidentally convert one into another.
|
That's a "language guard" against messing up, because strings and symbols are fundamentally different and should not accidentally convert one into another.
|
||||||
|
|
||||||
If we really want to show a symbol, we need to explicitly call `.toString()` on it, like here:
|
If we really want to show a symbol, we need to explicitly call `.toString()` on it, like here:
|
||||||
|
|
||||||
```js run
|
```js run
|
||||||
let id = Symbol("id");
|
let id = Symbol("id");
|
||||||
*!*
|
*!*
|
||||||
|
@ -61,6 +62,7 @@ alert(id.toString()); // Symbol(id), now it works
|
||||||
```
|
```
|
||||||
|
|
||||||
Or get `symbol.description` property to show the description only:
|
Or get `symbol.description` property to show the description only:
|
||||||
|
|
||||||
```js run
|
```js run
|
||||||
let id = Symbol("id");
|
let id = Symbol("id");
|
||||||
*!*
|
*!*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue