4 ms·
This is a bit confusing to me, if the key doesn't matter and no two symbols are equal, why would you ever use var foo = Symbol('foo') over var foo = Symbol()
by seanalltogether 11y ago
This is a bit confusing to me, if the key doesn't matter and no two symbols are equal, why would you ever use
var foo = Symbol('foo')
over
var foo = Symbol()
- kannanvijayan 11y agoMostly as a debugging aid. Stringifying the symbol will let you get at the internal string, which can be useful for tooling, introspection, etc.