FrontendDeveloper.in

ECMAScript question detail

Symbol description

While creating symbols, you also can add a description to it for debugging purposes. But there was no method to access the description directly before ES2019. Considering this, ES2019 introduced a read-only description property to retrieve a string containing the description of the Symbol.

This gives the possibility to access symbol description for different variations of Symbol objects

console.log(Symbol('one').description); // one

console.log(Symbol.for('one').description); // "one"

console.log(Symbol('').description); // ''

console.log(Symbol().description); // undefined

console.log(Symbol.iterator.description); // "Symbol.iterator"
Back to all ECMAScript questions
Get LinkedIn Premium at Rs 399