While on the topic of perspective, your human perspective on a problem is often very useful as humans tend to solve a lot of problems unconsciously. If you figure out/describe how YOU would do something, then you’ve probably laid out an algorithm right there, and then you can write that down.

One approach to this dogyears problem is to have two expressions, one for young dogs and one for old ones, and you’d use an if-statement to decide which to use.

Another approach is to see the age as two parts, the first two years and the rest. They have different multipliers to them and are then added:

```
dogYears = earlyYears * 10.5 + lateYears * 4
```

earlyYears would be the full age but at most 2, so one would pick the smallest of these two values

lateYears would be the full age minus 2 but at least 0, so one would pick the largest of these two values

The functions `Math.max`

and `Math.min`

could be used to figure those out, and then a single expression that covers the full possible range has been obtained.

But I didn’t start out by thinking that I want to solve it with min/max functions, I decided what I wanted to do first, and then started looking for matching parts in the language.