/* 100% grade: */
function Student(name, birthday) {
this.name = name; // Optional
this.birthday = birthday;
}
Student.prototype.checkIfBirthday = function(checkDate) {
return this.birthday.getDate() == checkDate.getDate() && this.birthday.getMonth() == checkDate.getMonth();
}
Student.prototype.isTodayBirthday = function() {
return this.checkIfBirthday(new Date());
}
/* End markable portion */
// Example code for testing -- not necessary to submit or marked.
var josh = new Student("Joshua Koudys", new Date("6, 4, 2014"));
console.log("Check if Feb 2nd is " + josh.name + "'s birthday: " + josh.checkIfBirthday(new Date("2015-02-02")));
console.log("Check if today is " + josh.name + "'s birthday: " + josh.isTodayBirthday());
/* Notes:
Student.name not strictly required, just included as an example of using objects.
The 'birthday' is passed in as a Date object, but it could be passed in as a string and set as a date inside the constructor.
*/
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.