# 章序号/节序号/节/笔记序号
codecademy, Variable
# 概念阐释
# 举例子
# 类比、比较与对比
# 问题
Dogs mature at a faster rate than human beings. We often say a dog’s age can be calculated in “dog years” to account for their growth compared to a human of the same age. In some ways we could say, time moves quickly for dogs — 8 years in a human’s life equates to 45 years in a dog’s life. How old would you be if you were a dog?
Here’s how you convert your age from “human years” to “dog years”:
- The first two years of a dog’s life count as 10.5 dog years each.
- Each year following equates to 4 dog years.
Before you start doing the math in your head, let a computer take care of it! With your knowledge of math operators and variables, use JavaScript to convert your human age into dog years.
*hint: 可以直接写成公式(10.5X2)+(myAge-2)x4
*想好variable name*
**1.**
[题目步骤](https://www.codecademy.com/courses/introduction-to-javascript/projects/dog-years-javascript)
**2.**
尝试用function写?
# 问题答案
**1.**
[答案](https://www.codecademy.com/workspaces/63bcd35fccf79a776f65a4ae)
**2.**
- 可以用function调用所有步骤了,但是不会重复调用,比如我想改成小柔的名字就不会了。[练习页面](https://www.codecademy.com/workspaces/63bcd35fccf79a776f65a4ae)
# 备注(经验集/错误集)