C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
JavaScript Symbol.toString() MethodThe JavaScript Symbol.toString() method purpose is to return a string representation of an object. SyntaxSymbol().toString(); ParametersNo Parameters. Return valueA string representing the specified Symbol object. Browser Support
Example 1<script> //JavaScript to illustrate Symbol.toString var v = Symbol("JavaTpoint"); var q = Symbol("Java"); document.write(v.toString(v)); document.write("<br>"); document.write(q.toString(q)); //expected output: //Symbol(JavaTpoint); //Symbol(Java); </script> Output: Symbol(JavaTpoint) Symbol(Java) Example 2<script> //JavaScript to illustrate Symbol.toString document.write(Symbol.for('DBMS').toString()); document.write("<br>"); document.write(Symbol.for('JavaTpoint').toString()); //expected output: Symbol(DBMS); //Symbol(JavaTpoint); </script> Output: Symbol(DBMS) Symbol(JavaTpoint)
Next TopicJavaScript Symbol
|