๐บSymbol
JS โฉ value โฉ primitive โฉ symbol
returns a primitive value that's guaranteed to be unique.
const unique = Symbol() // โญ๏ธ not `new Symbol()`โ๏ธ
let obj = {
[unique]: <value>, // symbol used as a computed property name
};
Symbols
only used as (computed) property names.โ
are primitive values, not objects, Symbol() is not a constructor.โ
can't invoke with newโ
Last updated
Was this helpful?