# JavaScript - Dog Years Project

Hi coders,

I have completed Dog Years project.

However there’s an suggestion at the end of the project that " If you’d like extra practice, try writing this project without the `*=` operator."

Does this mean without only *= operator or writting this project without using mathematical operators (+=, -=, *=, =).
If it can be written without using mathematical operators, then I still can’t think a way to do the project.
Any opinion? Thanks

I think they mean still using the mathematical operators, just not using specifically `*=`

For example,
you might do
`n = n * 2;`
`n *= 2;`

2 Likes

You could precalculate the dog year equivalencies - not an unreasonable task, since, depressingly, dogs don’t live that long. You’d store the results in an array or object and then return the results depending on the input year.

For example,

``````function dogYearsToHumanYears(dogAge) {
const dogToHumanAgeMap = {
1: 15,
2: 24,
3: 29,
4: 34,
5: 39,
etc.
}
``````

At this point, I realized my oldest boy is basically 39 and decided to stop thinking about it
But anyways, that’s one way you could do it. By the way, the equation I used for that is from: https://www.akc.org/expert-advice/health/how-to-calculate-dog-years-to-human-years/

1 Like

Hi there,

After posting this, I thought again about the task…something about my dumb head because this task must involve with mathematic calculation in order to convert the age. I though I would delete this post but I think who knows some else come up with solution without mathematical operators.

Thank you for your contributing to my question.

Hey you

Your written code to answer my question is interesting and I am trying to understand it.
I am new to JavaScript and a slow learner therefore I have not learnt about array yet or how to store the value in an array. I hope to learn about array soon.

It looks like your oldest boy is over 6 years old. .