Deep clone a value
JavascriptstructuredClone handles Dates, Maps, Sets and cycles, which JSON round-tripping quietly destroys.
const copy = structuredClone(original);
// What JSON.parse(JSON.stringify(x)) loses:
// Date -> string
// undefined -> dropped
// Map, Set -> {}
// cycles -> throws