Created
November 5, 2020 00:00
-
-
Save ilyahuman/96cd1de2e540185f482f67690dc0e6a1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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