Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. /*
  2. Dog year calculator
  3. */
  4.  
  5. // the age to calculate
  6. let myAge = 26;
  7. //
  8. let earlyYears = 2;
  9.  
  10. // first two years of a dogs life count as 10.5 dog years each
  11. earlyYears *= 10.5;
  12. // Since we already accounted for the first two years..
  13. let laterYears = myAge - 2;
  14. // calculate the number of dog years accounted for by your later years
  15. laterYears *= 4;
  16. // adds both ear and later years to calc dog years
  17. let myAgeInDogYears = earlyYears + laterYears;
  18.  
  19. let myName = ("Chris Tapia").toLowerCase()
  20. // stating the result
  21. 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