-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCat_Years.js
More file actions
30 lines (19 loc) · 828 Bytes
/
Cat_Years.js
File metadata and controls
30 lines (19 loc) · 828 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Mini Project: Cat Years
// Challenge: Convert Your Age to Cat Years
// assign my age to the variable `myAge`
var myAge = 30;
// assign value of `2` to variable `earlyYears`
var earlyYears = 2;
// multiply `earlyYears` by `25` to account for early growth rate
earlyYears *= 25;
// subtract `2` years from `myAge` and assign to `laterYears` to account for growth rate of a
// cat after the first two years
var laterYears = myAge -2;
laterYears *= 4;
// add value of `earlyYears` and `laterYears` for the total age and assign to `myAgeInCatYears`
var myAgeInCatYears = earlyYears + laterYears;
// assign the value of my name to the variable `myName`
var myName = 'Max';
console.log('My name is ' + myName + '. I am ' + myAge
+ ' years old in human years which is ' + myAgeInCatYears
+ ' years old in cat years.');