JS: Symbol.prototype

By Xah Lee. Date: . Last updated: .

(new in ECMAScript 2015)

What is Symbol.prototype

Symbol.prototype is the parent of all symbol objects.

console.assert(Reflect.getPrototypeOf(Object(Symbol())) === Symbol.prototype);
// Object(xx) converts symbol primitive xx to a symbol object

[see Prototype and Inheritance]

Properties

work in progress

Symbol.prototype.constructor

Symbol.prototype.description

Return the description of the symbol.

Symbol.prototype.toString( )

return a string of the form:

"Symbol(description)"

console.assert(Symbol("xyz").toString() === "Symbol(xyz)");

Symbol.prototype.valueOf ( )

Symbol.prototype [ Symbol.toPrimitive ] ( hint )

Symbol.prototype [ Symbol.toStringTag ]

JavaScript. Symbol