1
0
mirror of https://github.com/ruanyf/es6tutorial.git synced 2025-05-28 21:32:20 +00:00

Merge pull request #850 from wfzong/patch-3

Symble toString 修改为函数执行
This commit is contained in:
Ruan YiFeng 2019-05-08 07:34:09 -07:00 committed by GitHub
commit 62b5147d21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -115,7 +115,7 @@ const sym = Symbol('foo');
const sym = Symbol('foo');
String(sym) // "Symbol(foo)"
sym.toString // "Symbol(foo)"
sym.toString() // "Symbol(foo)"
```
上面的用法不是很方便。[ES2019](https://github.com/tc39/proposal-Symbol-description) 提供了一个实例属性`description`,直接返回 Symbol 的描述。