function Animal(){ this.type = "animal" } function Dog(){ this.name = "dog" } Dog.prototype = new Animal() var PavlovPet = new Dog(); console.log(PavlovPet.__proto__ === Dog.prototype) console.log(Dog.prototype.__proto__ === Animal.prototype)
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter