JSFiddle - React, Tailwind, and code Playground
HTML
<body>
<ul id="Container">
</ul>
</body>
JavaScript
function Person(name){
this.name = name;
this.type = 'human';
}
Person.prototype.info = function(){ return "Name: " + this.name + " Type:" + this.type; }
function Robot(name){
Person.call(this, name);
this.type = 'robot';
}
// Set Robot's prototype to Person's prototype
Robot.prototype = Object.create(Person.prototype);
$().ready(function(){
Container = $('#Container');
person = new Person("Bob");
robot = new Robot("Boutros");
Container.append('<li>'+person.info()+'</li>');
Container.append('<li>'+robot.info()+'</li>');
});
// Set constructor back to Robot
Robot.prototype.constructor = Robot;