JSFiddle - React, Tailwind, and code Playground
JavaScript
function Human() {
}
function Engineer(diploma) {
this.diploma = diploma;
}
Engineer.prototype = new Human();// Line A1
Engineer.prototype.constructor = Engineer;
Engineer.prototype.getDiploma = function() {
alert(this.diploma);
};
var engineer = new Engineer("Bridges and Roads");
engineer.getDiploma();
var human = new Human();
//this would generate: TypeError: human.getDiploma is not a function:
//human.getDiploma(); // Line A2