The main use case for ES6 symbols is that you can use them as property keys that can’t clash with other property keys.
When the new method
Array.prototype.values()was created, it broke existing code where
withwas used with an Array and shadowed a variable
valuesin an outer scope (bug report 1, bug report 2). Therefore, a mechanism was introduced to hide properties from
In contrast, adding iterability to an object via the property key
Symbol.iterator can’t cause problems, because that key doesn’t clash with anything.