Open
Description
We should have a method that duplicates an object, like this:
helpful.duplicateObject({"a": 1, "b": 2}) => {"a": 1, "b": 2}
You must use a for loop for this method to copy over all the keys and their corresponding values to the new object.
We should also have a method that duplicates an object and all inner objects, like this:
helpful.deepDuplicateObject({"a": 1, "b": 2, "c": {"d": 4, "e": 5}}) =>{"a": 1, "b": 2, "c": {"d": 4, "e": 5}}
We encourage using the duplicateObject
method and recursion to create the deepDuplicateObject
method.