JSFiddle - React, Tailwind, and code Playground
by Tim Morgan
HTML
<div class="exp">Hello</div>
JavaScript
// Doc on Dates: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
// How to check if a 'date' is the same
//call function with an argument
/* From class #2, demonstrate your knowledge of functions by writing:
- A function that checks if a date is your birthday
- A function that checks if today is your birthday */
// birthday.getDate() == checkdate.getDate() && birthday.getMonth() == checkdate.getMonth();
var date1 = Date("2014-05-02");
var date2 = new Date();
// Are they the same year?
if(date1.getYear() == date2.getYear()) {
console.log("they're the same year.");
}
// Are they the same month?
if(date1.getMonth() == date2.getMonth()) {
}
/ Are they the same day of the month?
if(date1.getDate() == date2.getDate()) {
}