Skip to content

Instantly share code, notes, and snippets.

@koyanloshe
Last active April 17, 2020 08:27
Show Gist options
  • Save koyanloshe/19e6c64d0ce0749ed5987b514475adbb to your computer and use it in GitHub Desktop.
Save koyanloshe/19e6c64d0ce0749ed5987b514475adbb to your computer and use it in GitHub Desktop.
Cloning objects without effects #Javascript
// Object.assign has an issue with nested Objects. This prevents that leakage
const cloneObj = (existingObj) => {
return JSON.parse(JSON.stringify(existingObj))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment