JSFiddle - React, Tailwind, and code Playground
by Abdul Ahmad
JavaScript
Object.prototype.cname = 'object';
function plant() {
this.sayparentname = function() { console.log(this.cname); };
}
plant.prototype.cname = 'plant';
function tomato() {
this.sayparentname = function() { console.log(this.cname); };
}
tomato.prototype = new plant();
var p = new plant();
var t = new tomato();
console.log(p);
p.sayparentname();
t.sayparentname();