This method is like clone except that it recursively clones value. Object inheritance is preserved.
clone
value
The value to recursively clone.
Returns the deep cloned value.
5.3.0
const objects = [{ 'a': 1 }, { 'b': 2 }]const deep = cloneDeep(objects)console.log(deep[0] === objects[0])// => false Copy
const objects = [{ 'a': 1 }, { 'b': 2 }]const deep = cloneDeep(objects)console.log(deep[0] === objects[0])// => false
This method is like
clone
except that it recursively clonesvalue
. Object inheritance is preserved.