Skip to content

Instantly share code, notes, and snippets.

View eamon0989's full-sized avatar

Eamon eamon0989

View GitHub Profile
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!' }
let foo = {
bar: 1,
};
console.log(foo.bar); // 1
console.log(foo.hasOwnProperty('bar')); // true