Using Symbol for Unique Property Keys in Javascript


Create unique identifiers for object properties using Symbol.

Source Code

let mySymbol = Symbol('mySymbol');
let obj = {
  [mySymbol]: 'value'
};
console.log(obj[mySymbol]); // "value"
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments