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.


RESETRUNFULL
<!DOCTYPE html><html><body><script>

var s = Symbol('h');console.log(s.toString()); // Symbol(h)console.log(s.valueOf());  // Symbol(h)//console.log(s+"");         // TypeError//console.log(s+0);          // TypeError

</script></body><html>