Skip to content

Instantly share code, notes, and snippets.

@Jagathishrex
Created December 30, 2020 15:20
Show Gist options
  • Save Jagathishrex/0aba7dbcfae8bb1440a71fa406e7804f to your computer and use it in GitHub Desktop.
Save Jagathishrex/0aba7dbcfae8bb1440a71fa406e7804f to your computer and use it in GitHub Desktop.
"use strict";
let user = { name : "Jagathish" };
Object.preventExtensions(user);
// user.age = 23; --> this will throw error
user.__proto__.age = 23; // adding property to object prototype
console.log(user); // {name : "Jagathish"}
console.log(user.age); // 23 --> this value comes from object prototype property
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment