Skip to content

Instantly share code, notes, and snippets.

@AkashRajvanshi
Created November 2, 2019 14:18
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/9ec154fbcee88a8eccfb54707ca285d1 to your computer and use it in GitHub Desktop.
Save AkashRajvanshi/9ec154fbcee88a8eccfb54707ca285d1 to your computer and use it in GitHub Desktop.
const user = {
firstName: 'Akash'
};
// Currently it is Extensible
console.log(Object.isExtensible(user)) // true
Object.preventExtensions(user)
console.log(Object.isExtensible(user)) // false
// Trying to adding something
user.lastName = 'Rajvanshi'
console.log('lastName' in user) // false ( We can't make additions to the 'user' object)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment