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.

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 compatibility

Feature Chrome Edge Firefox Internet Explorer Opera Safari
Basic support 38 12 36 No 25 9
Feature Android webview Chrome for Android Edge mobile Firefox for Android Opera Android iOS Safari Samsung Internet
Basic support Yes 38 Yes 36 25 9 ?

© 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