JSFiddle - React, Tailwind, and code Playground
JavaScript
function Fruit(eatable) {
this.eatable = eatable;
this.isEatable = function() {
return this.eatable;
};
}
function Apple(eatable , sweet) {
Fruit.call(this, eatable);
this.sweet = sweet;
this.isSweet = function() {
return this.sweet;
};
}
Apple.prototype = Object.create(Fruit.prototype);
var a = new Apple(true, false);
console.log(a.isEatable());