JSFiddle - React, Tailwind, and code Playground

by Joshua Koudys

JavaScript

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%