Skip to content

Instantly share code, notes, and snippets.

@ilyahuman
Created November 5, 2020 00:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilyahuman/96cd1de2e540185f482f67690dc0e6a1 to your computer and use it in GitHub Desktop.
Save ilyahuman/96cd1de2e540185f482f67690dc0e6a1 to your computer and use it in GitHub Desktop.
const makeDeepClone = (obj) => {
let newObject = {};
Object.keys(obj).map(key => {
if(typeof obj[key] === 'object'){
newObject[key] = makeDeepClone(obj[key]);
} else {
newObject[key] = obj[key];
}
});
return newObject;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment