Dog Years

Why does the code have this

let myAge = 22;
let earlyYears = 2; 
earlyYears *= 10.5;
let laterYears = myAge - 2; 
laterYears *= 4; 
console.log("earlyYears: " + earlyYears + "\n" + "laterYears: " +  laterYears);
let myAgeinDogYears = earlyYears + laterYears;
console.log("myAgeinDogYears: " + myAgeinDogYears);
myAge - 2;

What exactly is this -2? Why? I don’t get it :frowning:

Hey @ecrios2967265930 welcome to the forums

I believe that’s just how you calculate dog years.

Meh. It doesn’t seem to be an answer at all. The question is about the part myAge - 2.

The idea seems to be that the first 2 years are 10.5 dog years each.
And the each year after that is 4 dog years.

let laterYears = myAge - 2;
is done so the calculations for those “later years” can be done separately.

2 Likes