Why symbols?

Explanation of why symbols were added in JavaScript

Symbols were originally meant to be used as a mechanism to add private properties to objects and were supposed to be called "private name objects". But later, their name was changed to symbols, and they were made a primitive value.

It turned out that each symbol being a unique value is pretty useful because it allows the JavaScript language to be extended and remain backwards compatible. Symbols allow JavaScript to add new properties to objects that cannot conflict with the existing properties on objects that others might have used in their code.

One of the main goals of TC39 is to keep JavaScript backwards compatible. With this goal in mind, any new feature added to the language must not break existing code. Symbols help keep the promise of backward compatibility.

Some features in the JavaScript language require looking up a property on an object. What property keys could have been chosen for such features? Choosing any string property name wasn't possible because someone might have used that property in their code, and using that property for a new feature might have broken their code.