16. Symbol.prototype.description
This chapter describes the ES2019 feature “Symbol.prototype.description
” (by Michael Ficarra).
When creating a symbol via the factory function Symbol()
, you can optionally provide a string as a description, via a parameter:
Until recently, the only way to access the description was by converting the symbol to a string:
The feature introduces the getter Symbol.prototype.description
to access the description directly:
当前内容版权归 exploringjs.com 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 exploringjs.com .