JSFiddle - React, Tailwind, and code Playground

by Andra Jimenez

JavaScript

//This is assingment 2

function Birthday(date) { this.date = date;}

Birthday.prototype.isThisMyBirthday = function() { 
   var myBirthday = new Date("02-23-1987");
    
    if (myBirthday.getDate() == this.date.getDate()  &&       myBirthday.getMonth() == this.date.getMonth()){ 
        return("today is your birthday");}
     
    else {
        return("It is not your birthday");}
    };

// instantiate object
var january = new Birthday(new Date("02-23-1987"));
var today = new Birthday(new Date());

console.log("Is Jan 23 my birthday? " + january.isThisMyBirthday());
console.log("Is today my birthday? " + today.isThisMyBirthday());