// Inheritance using classes
class BaseClass {}
class DerivedClass extends BaseClass {}
let c = new DerivedClass()
console.log(c)
console.log(c.__proto__)
console.log(c.__proto__.__proto__)
console.log(c.__proto__.__proto__.__proto__)
console.log()
// Inheritance using constructor functions
function BaseFunction() {}
function DerivedFunction() {}
// set prototypal inheritance chain
Object.setPrototypeOf(DerivedFunction.prototype, BaseFunction.prototype)
let f = new DerivedFunction()
console.log(f)
console.log(f.__proto__)
console.log(f.__proto__.__proto__)
console.log(f.__proto__.__proto__.__proto__)
To embed this project on your website, copy the following code and paste it into your website's HTML: