//1.
var isItCordeliaFongBirthday = function(date){
var date = new Date(2014,0,29);
if(date.getMonth() == today.getMonth())
console.log("True");
};
else{
console.log("False");
};
return(date);
};
isItCordeliaFongBirthday(date);
// -1 Don't redeclare 'date' in your function; it's already passed in.
// -1 You should be returning an actual 'true' or 'false', not logging it
// 4/6
//2.
var isItCordeliaFongBirthday = function(date){
var date = new Date(2014,0,29);
return true;
};
isItCordeliaFongBirthday(date);
// -1 This function shouldn't take a date
// -1 You're not calling your original function
// -1 You're not naming the function a new name, as specified in the question.
// 3/6
//3.
for(var currentDate = new Date(2014,0,29); !isItCordeliaFongBirthday(currentDate) == birthday.getDate() && currentDate.getMonth() == birthday.getMonth()); currentDate.setDate(currentDate.getDate() + 1)) {
var birthday = new Date(2014,9,9);
if (currentDate === birthday){
alert("Happy Birthday!");
};
return true;
};
// -0.5 you should be using your function as the comparison, and nothing else. It simplifies the expression to:
// for(var currentDate = new Date(2014,0,29); !isItCordeliaFongBirthday(currentDate); currentDate.setDate(currentDate.getDate() + 1)) {
// 1.5/2
var howManyDaysUntilCordeliaFongsBirthday= function(todayDate,birthdayDate){
var todayDate = new Date(2014,0,29);
var birthdayDate = new Date(2014,9,9);
var howManyDaysLeft = birthdayDate.getTime() - todayDate.getTime());
howManyDaysUntilCordeliaFongsBirthday("There are " + howManyDaysLeft + " days " until September 9th 2014");
// Not really; you need to call the functions you made earlier.
// Total: 3+4+1.5=8.5/14, or 61%
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.