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 theObject.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 theObject.prototype.valueOf()
method. Symbol.prototype[@@toPrimitive]
- Returns the primitive value of the
Symbol
object.
Specifications
Specification | Status | Comment |
---|---|---|
ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'Symbol.prototype' in that specification. |
Standard | Initial definition. |
ECMAScript Latest Draft (ECMA-262) The definition of 'Symbol.prototype' in that specification. |
Draft |
Browser compatibility
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | ? | (Yes) | 36.0 (36.0) | No support | No support | No support |
@@toPrimitive | ? | ? | 44.0 (44.0) | ? | ? | ? |
Feature | Android | Chrome for Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | (Yes) | 36.0 (36.0) | No support | No support | No support |
@@toPrimitive | ? | ? | ? | 44.0 (44.0) | ? | ? | ? |