Returns a deep copy of the provided value in the following way:
The type of the value to be cloned.
The value to be cloned.
A deep copy of the provided value.
const a = { value: [1, 2, 3] };const b = clone(a);b.value[0] = 4;console.log(a); // { value: [1, 2, 3] }console.log(b); // { value: [4, 2, 3] } Copy
const a = { value: [1, 2, 3] };const b = clone(a);b.value[0] = 4;console.log(a); // { value: [1, 2, 3] }console.log(b); // { value: [4, 2, 3] }
Returns a deep copy of the provided value in the following way:
Type Param: T
The type of the value to be cloned.
Param: value
The value to be cloned.
Returns
A deep copy of the provided value.
Example