I Googled a lot about new primitive type "Symbol" but still cannot understand actual use of it. What I understood is:
- They are a primitive type, just as integer or string.
- They are not a constructor function, hence you cannot use
new Symbol()
syntax.
But why is it used? String/Integer/Boolean have their uses which are clear, but what's the use of Symbol() exactly?
Moreover, for this code:
var data1 = Symbol();
var data2= Symbol('dummy');
why Symbol('dummy') === Symbol('dummy')
is false?