Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

JavaScript Symbol description Property

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

JavaScript symbol description is an inbuilt property in JavaScript which is used to return the optional description of the specified symbol objects.

Syntax: Here “A” is the specified symbol objects which might be Symbol(‘anyValues’), Symbol.iterator, Symbol.for(‘anyValues’) etc.

A.description;

Parameters: This property does not accept any parameter.

Return value: This property returns the optional description of the specified symbol objects.

Below examples illustrate the JavaScript Symbol description Property.

Example 1:




<script>
  
   // Calling description property over
   // some specified symbol objects
   document.write(Symbol('Geek').description +"<br>");
   document.write(Symbol.iterator.description +"<br>");
   document.write(Symbol.for('GeeksforGeeks').description +"<br>");
   document.write(Symbol('Geeks').description + 'forGeeks');
      
</script>

Output:

Geek
Symbol.iterator
GeeksforGeeks
GeeksforGeeks

Example-2:




<script>
  
   // Calling description property over
   // a specified symbol objects
   document.write(Symbol().description +"<br>");
      
</script>

Output:

undefined

In the above code, symbol object “Symbol()” should have some parameters otherwise it gives undefined as the output.

Supported Browsers:

  • Chrome 70 and above
  • Edge 79 and above
  • Firefox 63 and above
  • Opera 57 and above
  • Safari 12.1 and above

We have a complete list of Javascript symbols’ properties and methods, to check those please go through the Javascript Symbol Complete Reference article.

My Personal Notes arrow_drop_up
Last Updated : 19 May, 2023
Like Article
Save Article
Similar Reads
Related Tutorials