JSFiddle - React, Tailwind, and code Playground
by Anchit Gupta
JavaScript
function Animal() {
this.type = "animal";
this.walk = "can walk";
this.category = "veg";
}
Animal.prototype.eat = function () {
return this.type + " is a " + this.category;
}
var animal = new Animal();
alert(animal.eat());
function Dog() {
this.type = "Dog";
this.category = "non-veg";
}
Dog.prototype = new Animal();
Dog.prototype.constructor = Dog();
Dog.prototype.eat = function() {
return Animal.prototype.eat.call
}
var dog = new Dog();
alert(dog.eat());