Skip to content

duplicateObject and deepDuplicateObject #29

Open
@CMEONE

Description

@CMEONE

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions