Friday, November 15, 2024
Google search engine
HomeLanguagesJavascriptJavaScript Symbol description Property

JavaScript Symbol description Property

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

Syntax: Here “A” is the specified symbol object 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.

Example 1: The below examples illustrate the JavaScript Symbol description Property.

javascript




// Calling description property over
// some specified symbol objects
console.log(Symbol('Geek').description);
console.log(Symbol.iterator.description);
console.log(Symbol.for('neveropen').description);
console.log(Symbol('Geeks').description + 'forGeeks');


Output

Geek
Symbol.iterator
neveropen
neveropen


Example 2: The below examples illustrate the JavaScript Symbol description Property.

javascript




// Calling description property over
// a specified symbol objects
console.log(Symbol().description);


Output

undefined


In the above code, the 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.

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

RELATED ARTICLES

Most Popular

Recent Comments