Es6: Destructuring An Object With Symbols As Keys
I have an object that contains symbols as keys. How do I do destructuring assignment in this case? let symbol = Symbol() let obj = {[symbol]: ''} let { /* how do I create a variabl
Solution 1:
Use an alias (see assigning to new variable names):
let symbol = Symbol()
let obj = { [symbol] : 'value'}
let { [symbol]: alias } = obj
console.log(alias)
Post a Comment for "Es6: Destructuring An Object With Symbols As Keys"