How do you shallow-clone an ES6 Map or Set object?
I want to get a new Map or Set that has the same keys and values.
How do you shallow-clone an ES6 Map or Set object?
I want to get a new Map or Set that has the same keys and values.
Use the constructor to clone Maps and Sets:
var clonedMap = new Map(originalMap)
var clonedSet = new Set(originalSet)