JSFiddle - React, Tailwind, and code Playground
JavaScript
function AnotherMan(name) {
this.name = name;
}
function Mr(name) {
AnotherMan.call(this, name); // Call the superclass's constructor in the scope of this.
this.name = "Mr. " + name; // Add an attribute to Author.
}
Mr.prototype = new AnotherMan(); // Set up the prototype chain.
Mr.prototype.constructor = Mr; // Set the constructor attribute to Mr.
var mrBean = new Mr("Bean");
alert(mrBean.name + ', instance of AnotherMan: ' + (mrBean instanceof AnotherMan));