Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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()



Mostly as a debugging aid. Stringifying the symbol will let you get at the internal string, which can be useful for tooling, introspection, etc.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: