Symbol Prototype Methods

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.


var s = Symbol('h');

console.log(s.toString());
console.log(s.valueOf());

// console.log(s + "");  // TypeError
// console.log(s + 0);   // TypeError

Symbol(h) Symbol(h)