Skip to content

Instantly share code, notes, and snippets.

@Jagathishrex
Last active November 25, 2019 23:59
Show Gist options
  • Save Jagathishrex/ba23b837ff09ef78f3be40ed9b443609 to your computer and use it in GitHub Desktop.
Save Jagathishrex/ba23b837ff09ef78f3be40ed9b443609 to your computer and use it in GitHub Desktop.
function copy(sourceObj) {
let targetObj = {};
let keys = Object.keys(sourceObj);
for (let i = 0, len = keys.length; i < len; i++) {
let key = keys[i];
targetObj[key] = sourceObj[key];
}
return targetObj;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment