What are Symbols in JavaScript and how can they be used?
Instruction: Explain the concept of Symbols and provide examples of their usage.
Context: This question evaluates the candidate's knowledge of ES6 features and their ability to work with unique identifiers.
Updated
Official answer available
Read the opening below, then unlock the full answer and practical guidance.
A Symbol is a primitive that can be used as an object property key without colliding with an ordinary string key. Calling Symbol with a description creates a fresh identity; the description is a debugging label, not the key's identity. Symbol.for instead looks up or creates a symbol in the global symbol registry for a string key...