JSFiddle - React, Tailwind, and code Playground

by Jesus Trejo

JavaScript

var DonutBox = ["chocolate", "Glassed", "Traditional Polish pączki", "Traditional Berliner pastry", "Puffpuff", "Buñuelos"];


DonutBox.prototype.eat = function () {
    alert('We are Delicious!');
};
DonutBox.prototype.eatUs = function () {
    alert('Yummy!');
};


function OtherDonut() {

    DonutBox.call(this);
}


OtherDonut.prototype = new DonutBox();


OtherDonut.prototype.constructor = OtherDonut;


OtherDonut.prototype.eatUs = function () {
    alert('We Are yumier!');
};


OtherDonut.prototype.enjoy = function () {
    alert('Burp');
};

var OtherDonut1 = new OtherDonut();
OtherDonut1.eatUs();
OtherDonut1.eat();
OtherDonut1.enjoy();


alert(OtherDonut1 instanceof DonutBox);
alert(OtherDonut1 instanceof OtherDonut);