Get the description of a ES6 Symbol

后端 未结 4 518
渐次进展
渐次进展 2020-11-29 10:11

I wonder if there is a nice way to get the descriptions of a Symbol.

For example,

var s = Symbol(5);

The default implementation of

4条回答
  •  迷失自我
    2020-11-29 11:12

    Symbol.description returns description of the symbol. Simply do s.description in your case.

    REF: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/description

提交回复
热议问题