Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Dog year calculator
- */
- // the age to calculate
- let myAge = 26;
- //
- let earlyYears = 2;
- // first two years of a dogs life count as 10.5 dog years each
- earlyYears *= 10.5;
- // Since we already accounted for the first two years..
- let laterYears = myAge - 2;
- // calculate the number of dog years accounted for by your later years
- laterYears *= 4;
- // adds both ear and later years to calc dog years
- let myAgeInDogYears = earlyYears + laterYears;
- let myName = ("Chris Tapia").toLowerCase()
- // stating the result
- console.log(`My name is ${myName}. I am ${myAge} years old in human years which is ${myAgeInDogYears} years old in dog years.`)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement