Escribe una función que devuelva una copia profunda de un objeto dado.
La copia no debe ser el mismo objeto que se le dio.
Esta tarea no probará para:
Objetos con propiedades que son funciones Objetos de fecha u objeto con propiedades que son objetos de fecha RegEx u objeto con propiedades que son objetos de RegEx Copia de prototipodeepcopy
debe ser una función.
testString: 'assert(typeof deepcopy === "function", "deepcopy
should be a function.");'
- text: 'deepcopy({test: "test"})
debe devolver un objeto.'
testString: 'assert(typeof deepcopy(obj1) === "object", "deepcopy({test: "test"})
should return an object.");'
- text: No debe devolver el mismo objeto que se proporcionó.
testString: 'assert(deepcopy(obj2) != obj2, "Should not return the same object that was provided.");'
- text: 'Cuando se pasa un objeto que contiene una matriz, debe devolver una copia profunda del objeto.'
testString: 'assert.deepEqual(deepcopy(obj2), obj2, "When passed an object containing an array, should return a deep copy of the object.");'
- text: 'Cuando se pasa un objeto que contiene otro objeto, debe devolver una copia profunda del objeto.'
testString: 'assert.deepEqual(deepcopy(obj3), obj3, "When passed an object containing another object, should return a deep copy of the object.");'
```