TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

JavaScript Symbol toString() Method

JavaScript Symbol toString() Method with examples on javascript symbol methods, javascript symbol property, javascript tutorial, hasInstance, isConcatSpreadable, match, prototype, search, for(), keyFor(), toString(), unscopables, toPrimitive, split etc.

<< Back to JAVASCRIPT

JavaScript Symbol.toString() Method

The JavaScript Symbol.toString() method purpose is to return a string representation of an object.

Syntax

Symbol().toString();

Parameters

No Parameters.

Return value

A string representing the specified Symbol object.

Browser Support

Chrome 38
Safari 9
Firefox 36
Opera 25

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>
Test it Now

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>
Test it Now

Output:

Symbol(DBMS)
Symbol(JavaTpoint)

Next TopicJavaScript Symbol




Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf