This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let foo = { | |
bar: 1, | |
}; | |
console.log(foo.bar); // 1 | |
console.log(foo.hasOwnProperty('bar')); // true |
NewerOlder