W3cubDocs

/JavaScript

Symbol.prototype

The Symbol.prototype property represents the prototype for the Symbol constructor.

Property attributes of Symbol.prototype
Writable no
Enumerable no
Configurable no

Description

Symbol instances inherit from Symbol.prototype. You can use the constructor's prototype object to add properties or methods to all Symbol instances.

Properties

Symbol.prototype.constructor
Returns the function that created an instance's prototype. This is the Symbol function by default.
Symbol.prototype.description
A read-only string containing the description of the symbol.

Methods

Symbol.prototype.toSource()
Returns a string containing the source of the Symbol object. Overrides the Object.prototype.toSource() method.
Symbol.prototype.toString()
Returns a string containing the description of the Symbol. Overrides the Object.prototype.toString() method.
Symbol.prototype.valueOf()
Returns the primitive value of the Symbol object. Overrides the Object.prototype.valueOf() method.
Symbol.prototype[@@toPrimitive]
Returns the primitive value of the Symbol object.

Specifications

Browser compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
Basic support 38 12 36 No 25 9
Mobile
Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android iOS Safari Samsung Internet
Basic support Yes 38 Yes 36 25 9 Yes
Server
Node.js
Basic support Yes

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/prototype