One of the most yucky way to copy an object, especially nest objects was JSON stringifying
and decoding it. This method is bad whenever you’re trying to copy Date
or Set
types.
This article by Builder.io show an excellent way to clone said objects using structuredClone
available both on Node and the browser.