Skip to content

Instantly share code, notes, and snippets.

@AkashRajvanshi
Created November 2, 2019 13:38
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 AkashRajvanshi/fd762ae4c88f4cd6493846c9d3328939 to your computer and use it in GitHub Desktop.
Save AkashRajvanshi/fd762ae4c88f4cd6493846c9d3328939 to your computer and use it in GitHub Desktop.
delete user.firstName
console.log(user.firstName) //undefined
console.log(Object.keys(user) // [ 'lastName', 'fullname' ]
// But if we set a property to 'undefined', the property still exits and the object still contains its key.
user.firstName = undefined
console.log(Object.keys(user)) // [ 'lastName', 'fullname', 'firstName' ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment