JSFiddle - React, Tailwind, and code Playground

by Joshua Koudys

JavaScript

//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%