const set = new Set([1, 2, 3])
const clone = structuredClone(set)
clone.has(2) // β truestructuredClone() can deep-clone Set objects while preserving their type.
Use structuredClone() to clone a Map. The clone is a separate Map instance with the same entries.