Self proclaimed Director of Fun ๐ and PHP Nerd ๐ค
class AboutMe {
constructor() {
this.username = "@timhussey";
this.fullname = "Tim Hussey";
this.location = "Arizona";
this.occupation = "Software Engineer";
this.company = "Showit";
this.birthday = new Date(1984, 6, 29); // months are 0-indexed Born in July
this.hobbies = [
"singing",
"coding",
"roller blading",
"axe throwing",
"gaming",
"acting",
"photography",
];
}
get age() {
const currentYear = new Date().getFullYear();
return currentYear - this.birthday.getFullYear();
}
introduce() {
const { username, fullname, location, occupation, company } = this;
return `Hello! I'm ${fullname} (known as ${username}). I'm a ${occupation} at ${company} and I live in ${location}.`;
}
isBirthdayToday() {
const today = new Date();
return today.getMonth() === this.birthday.getMonth() &&
today.getDate() === this.birthday.getDate()
? "Hey, it's my birthday today! ๐"
: "Just a regular day for me.";
}
}
const me = new AboutMe();
console.log(me.introduce());
console.log(`I'm currently ${me.age} years old.`);
console.log(me.isBirthdayToday());