Lesson overview · Free interview practice

Symbols

Understand unique property keys and well-known symbols.

Topics in the full lesson
  • Introduction to Symbols
  • Creating and Using Symbols
  • Well-Known Symbols
  • Practical Applications of Symbols
  • Best Practices
  • Exercises

Try the free interview questions

Work through a question before revealing its explanation. These questions and answers are free; Premium adds the full lesson walkthrough, examples and implementation detail.

TheoryEasy

What is a Symbol

Question

What is a Symbol in JavaScript, and what guarantees does it provide? How does it differ from other primitives?

Take a moment to think about this before revealing the answer

Explain your reasoning or try an implementation before comparing answers.

TheoryEasy

Well-Known Symbols

Question

What are well-known Symbols, and what do the most-asked ones (Symbol.iterator, Symbol.toPrimitive, Symbol.hasInstance) customize?

Take a moment to think about this before revealing the answer

Explain your reasoning or try an implementation before comparing answers.

TheoryEasy

Enumerating Symbol Properties

Question

Why are Symbol-keyed properties hidden from Object.keys and for...in? How do you actually enumerate them?

Take a moment to think about this before revealing the answer

Explain your reasoning or try an implementation before comparing answers.

TheoryMedium

Symbols as Collision-Safe Property Keys

Question

How do Symbols prevent property-name collisions? When should you use Symbol.for() instead of Symbol()?

Take a moment to think about this before revealing the answer

Explain your reasoning or try an implementation before comparing answers.

TheoryHard

Customizing with Well-Known Symbols: `toPrimitive` / `toStringTag` / `hasInstance`

Question

Implement a Money class with three customizations: Symbol.toPrimitive for context-aware coercion, Symbol.toStringTag for nice logging, and Symbol.hasInstance for duck-typed instanceof.

Take a moment to think about this before revealing the answer

Explain your reasoning or try an implementation before comparing answers.

Explore the full Symbols material

Premium includes the complete lessons and implementation references. Free practice questions remain available without a subscription.

All course tracks & premium content
From basics to advanced masterclasses
Built for JS/TS developers like you
Real-world tips & common pitfalls
Upgrade to Premium

Continue in this section