DE
Size: a a a
DE
p
p
p
DE
p
DE
p
p
DE
F
DE
function Dog (name) {
this.name = name;
}
Dog.prototype.bark = function () { console.log('woof'); };
let dog = new Dog('fluffie');
// DON'T:
// Old method using __proto__ deprecated!
console.log(dog.__proto__);
// DO:
// Using the newer getPrototypeOf function
console.log(Object.getPrototypeOf(dog));
// What about climbing up the prototype chain like this?
console.log(dog.__proto__.__proto__);
// We can simply nest the Object.getPrototypeOf() method calls like this:
console.log(Object.getPrototypeOf(Object.getPrototypeOf(dog)))
S
function Dog (name) {
this.name = name;
}
Dog.prototype.bark = function () { console.log('woof'); };
let dog = new Dog('fluffie');
// DON'T:
// Old method using __proto__ deprecated!
console.log(dog.__proto__);
// DO:
// Using the newer getPrototypeOf function
console.log(Object.getPrototypeOf(dog));
// What about climbing up the prototype chain like this?
console.log(dog.__proto__.__proto__);
// We can simply nest the Object.getPrototypeOf() method calls like this:
console.log(Object.getPrototypeOf(Object.getPrototypeOf(dog)))
DE
p
DE
p
F