structuredClone()
The global structuredClone() method creates a deep clone of a given value.
Syntax
structuredClone(value)
Parameters
value- : The object to be cloned.
Return value
The returned value is a deep copy of the original value.
Exceptions
DataCloneError- : Thrown if any part of the input value is not serializable.
Description
This function can be used to deep copy JavaScript values.