Assignment1 part2

Object Operating JS

by Andra Jimenez

CSS

/*function IsThisMyBirthday(selectedDate) {
    var birthday = new Date("02-23-1987");
    var checkdate = new Date(selectedDate);

    if (birthday.getDate() == checkdate.getDate()  &&   birthday.getMonth() == checkdate.getMonth()){ 
        alert("today is your birthday");}
     
    else {
        alert("It is not your birthday");}
    } 

alert(IsThisMyBirthday(new Date()));*/

JavaScript

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

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

// instantiate object
var Birthday1 = new Birthday(new Date("02-23-1987"));
var Birthday2 = new Birthday(new Date("02-24-1987"));

console.log(Birthday1.isThisMyBirthday());



/*EXAMPLE
function Person(firstName, lastName) { this.name = firstName + "  " + lastName; }
Person.prototype.sayHi = function() { return "Hello " + this.name + "!"; };
// instantiate object
var josh = new Person("Josh", "Koudys");
// say Hi
console.log(josh.sayHi());*/