Symbol.prototype JavaScript

The JavaScript Symbol.prototype property gives a prototype for the symbol constructor. Symbol.prototype is the parent of all Symbol objects. Syntax: Symbol.prototype Returns: Prototype for the symbol constructor. Example 1: <!DOCTYPE html> <html> <body> <script> var alpha = Symbol(‘HELLO’); Symbol.prototype.toString = function() { return (‘HELLO WORLD!’); } document.write(alpha.toString()); </script> </body> </html> Example 2: <!DOCTYPE html> <html> … Read more