var isItPearlinBirthday = function (date) {
var date = new Date ();
date.setFullYear (2000,2,26);
var today = new Date();
if ( date.getMonth() == today.getMonth()){
return true;
} else {
return false;
}
};
// -1 Don't redeclare a variable if you're passing it in as function input. 5/6
//2
var isTodayPearlinBirthday = function (date) {
var date = new Date ();
if (isItPearlinBirthday.getDate() == today.getDate()) {
alert "Happy B'day";
}
}
// -1 Here, you don't need to take 'date' as an input, because you want to use today's date.
// -1 You're not using the date comparison given in the quiz. These values can't be compared directly, since it's just the day of the month, but you need to compare the month too
// 4/6
//3
var date = new Date();
var d = date.setFullYear (2000,2,26);
for ( var i= new Date();!(i.getDate() == d.getDate() && i.getMonth() == d.getMonth()); i.setDate(i.getDate() + 1) {
alert "Happy B'day";
}
// -0.5 you conditional actually makes sense, but since this is a functions quiz you missed the chance to use your function as the condition. for(var i=new Date(); !isItPearlinBirthday(i); i.setDate(i.getDate()+1)) would've made more sense.
// 1.5/2
var today = new Date ();
var howManyDays = new Date();
var year = howMayDays.getFullYear();
howManyDays.setDate(date);
howManyDays.setMonth(month);
howMayDays.setFullYear(year+1);
var result=(Math.floor((howManydays.getTime()-today)/86400000))
if (result>=365){
result = result - 365;
alert (result);
}
// Sorry; good try but I can't really see what it's trying to do here. No bonus.
// Total: 10.5/14; 75%
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.