Course contentsShow
← JavaScript
Lesson 1011 of 2,72323. SymbolsFree lesson

What Are Well-Known Symbols?

Learn how JavaScript uses predefined symbols to customize language behavior and object capabilities.

What Are Well-Known Symbols?

You'll learn what well-known symbols are and how JavaScript uses them to let you customize built-in language behaviors.

The Core Idea

Remember how symbols are unique, private-like keys for object properties? Well, JavaScript reserves a special set of symbols—called well-known symbols—that act like "configuration hooks" for built-in operations. These aren't symbols you create with Symbol(); they're pre-defined properties on the Symbol object itself that the JavaScript engine recognizes and responds to.

Think of well-known symbols as VIP backstage passes. While regular symbols let you add private properties to objects, well-known symbols give you access to customize how JavaScript's core features interact with your objects—things like iteration, type conversion, and more.

How They Work

Well-known symbols are accessed as properties on the Symbol constructor, like Symbol.iterator or Symbol.toStringTag. When you add a method with one of these special symbol keys to your object, JavaScript's built-in operations will call that method automatically.

For example, if you want to make your custom object work with for...of loops (which you'll learn later), you'd add a method with the Symbol.iterator key. JavaScript sees that well-known symbol and knows, "Aha! This object has custom iteration logic."

These symbols have descriptive names (like iterator, toStringTag) that hint at what they control, and they're guaranteed to be unique and consistent across your entire program.

Why They Matter

Well-known symbols are JavaScript's way of making built-in features extensible without risking name collisions. Since they're symbols (not strings), you can't accidentally override them with normal properties.

Key Takeaway: Well-known symbols are pre-defined symbols provided by JavaScript that let you customize how built-in operations interact with your objects—they're the language's official "customization points."