C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
JavaScript Symbol.toStringTag PropertiesThe JavaScript Symbol.toStringTag symbol is accessed internally by the Object.prototype.toString() method. It is used for the creation of the default string description of an object. SyntaxSymbol.toStringTag ParametersString Return valueString Object. Browser Support
Example 1<script> //JavaScript to illustrate Symbol.toStringTag class ToString {get [Symbol.toStringTag]() { return 'JavaTPoint'; } } document.write(Object.prototype.toString.call(new ToString())); //expected output: [object JavaTPoint] </script> Output: [object JavaTPoint] Example 2<script> //JavaScript to illustrate Symbol.toStringTag document.write(Object.prototype.toString.call(([1,2,3]))); document.write("<br>"); document.write(Object.prototype.toString.call((true))); //expected output: [object Array] //[object Boolean] </script> Output: [object Array] [object Boolean]
Next TopicJavaScript Symbol
|