Skip to content

Instantly share code, notes, and snippets.

@eamon0989
Last active July 26, 2021 09:36
Show Gist options
  • Save eamon0989/fc17553a2a687629e6f3a2a253d86895 to your computer and use it in GitHub Desktop.
Save eamon0989/fc17553a2a687629e6f3a2a253d86895 to your computer and use it in GitHub Desktop.
let obj = {};
console.log(Object.prototype); // [Object: null prototype] {}
console.log(Object.getPrototypeOf(obj)); // [Object: null prototype] {}
console.log(Object.prototype === Object.getPrototypeOf(obj)); // true
console.log(Object.prototype.isPrototypeOf(obj)); // true
Object.prototype.foo = 'Hey there!';
console.log(Object.prototype); // [Object: null prototype] { foo: 'Hey there!' }
console.log(obj.foo); // Hey there!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment