Hacker News new | ask | show | jobs
by lennoff 1816 days ago
Iteration protocols[1] are also nice (`Symbol.iterator`[2] and `Symbol.asyncIterator`[3])

[1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

[2]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

[3]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

1 comments

Symbols + Maps have some neat gotchas that are good to be aware of.

For example, if you use Symbols as keys in an object, Object.keys() or for...of/in will NOT return/iterate over those keys. You have to use Object.getOwnPropetySymbols()...