Opens in a new tab
A picture of Jeff Brigman
I CODE TODAY FOR
A BETTER TOMORROW

Glossary Term

Symbol.toStringTag

2 tags 1 category

The Symbol.toStringTag static data property represents the well-known symbol Symbol.toStringTag. Object.prototype.toString() looks up this symbol on the this value for the property containing a string that represents the type of the object.

Some values do not have Symbol.toStringTag, but have special toString() representations. For a complete list, see Object.prototype.toString().

Most built-in objects provide their own [Symbol.toStringTag] property. Almost all built-in objects’ [Symbol.toStringTag] property is not writable, not enumerable, and configurable; the exception is Iterator, which is writable for compatibility reasons.

For constructor objects like Promise, the property is installed on Constructor.prototype, so that all instances of the constructor inherit [Symbol.toStringTag] and can be stringified. For non-constructor objects like Math and JSON, the property is installed as a static property, so that the namespace object itself can be stringified. Sometimes, the constructor also provides its own toString method (for example, Intl.Locale), in which case the [Symbol.toStringTag] property is only used when you explicitly call Object.prototype.toString on it.

Term Connections

Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.

Loading term connections…