Skip to content

Instantly share code, notes, and snippets.

@Harrisonkamau
Created December 16, 2020 21:29
Show Gist options
  • Save Harrisonkamau/35633098f1ac71e19296eef92eb0ff42 to your computer and use it in GitHub Desktop.
Save Harrisonkamau/35633098f1ac71e19296eef92eb0ff42 to your computer and use it in GitHub Desktop.
Check if Object has Key and Object deep cloning in JavaScript
const hasKey = (obj, key) => obj[key] === undefined;
const deepCloneObj = (obj) => JSON.parse(JSON.stringify(obj));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment