If your object does not have sub-objects then you only need a "shallow" clone. If the object has sub-objects that you also want to manipulate, then you need a "background" clone.
I would recommend using a library like Undercore.js or Lo-Dash that have utilitarian methods for both forms of cloning.
If your object only contains data of primitive types ( Boolean
, Number
, String
, Null
) or other sub-objects or sub-object arrays also only with primitive types, ie your object is very simple, with no dates or custom objects, so there is a shortcut that is somewhat inelegant but that works: var clone = JSON.parse(JSON.stringify(seuObjeto));
.