JSFiddle - React, Tailwind, and code Playground

by Karl Hui

JavaScript

function Birthday(month) {
    this.month = month;
alert('Birthday instantiated');
}
Birthday.prototype.month = ' ';

Birthday.prototype.sayHappyBirthday = function(){
    alert("Happy birthday.");
};

Birthday.prototype.sayNotYourBirthday = function() {
    alert("It's not your birthday.");
};

var birthday1 = new Birthday('March');
var birthday2 = new Birthday('June');
alert("The 1st birthday is in " + birthday1.month);
alert("The 2nd birthday is in " + birthday2.month);
birthday1.sayHappyBirthday();
birthday2.sayNotYourBirthday();