let myAge = 20;
let futureYear = 2060;
console.log("I'm " + myAge + " now, but in " + futureYear + " I'll be " + futureAge(myAge, futureYear));
myAge = 32;
futureYear = 2047;
console.log("I'm " + myAge + " now, but in " + futureYear + " I'll be " + futureAge(myAge, futureYear));
function futureAge(currentAge, futureYear) {
let now = new Date();
let thisYear = now.getFullYear();
return currentAge + (futureYear - thisYear);
}
console.log(petGenerator());
function petGenerator() {
let petNames = ['Charlie', 'Max', 'Bella', 'Fluffi', 'Petunia', 'Bloo', 'Sushi'];
let animalTypes = ['bird', 'cat', 'dog', 'horse', 'tiger', 'chinchilla', 'bunny'];
let animalColors = ['tan', 'black and white', 'spotted', 'striped', 'red-orange', 'rainbow', 'brown'];
let randomNumber = Math.floor(Math.random() * 7);
let newPet = {
name: petNames[randomNumber],
type: animalTypes[randomNumber],
color: animalColors[randomNumber]
};
return "Your new pet is a " + newPet.color + " " + newPet.type + " named " + newPet.name + "!";
}