Shih-Min Lee's Personal website

dating, chating, food, games, search

Follow me on GitHub

😱 ES6 Symbols

Symbol

  • Symbol is a new primitive.
  • Symbol can be used for debugging.
  • Symbols can be used as Object keys. It will not conflict with string keys.
  • It can be used as class private properties

https://i.stack.imgur.com/cxAOy.png

  • If you don’t have the reference for the Symbol, you just can’t use it. This also means two symbols will never equal the same value, even if they have the same description.

–

references:

03 Aug 2017