const calcAge = function (birthYear) {
return 2022 - birthYear
}
const yearsUntilRetirement = function (birthYear, firstName) {
const age = calcAge(birthYear);
const retierment = 65 - age;
if(retierment > 0) {
console.log(`${firstName} retires in ${retierment} years!`);
return retierment;
} else {
console.log(`${firstName} has already retired!`);
return `${firstName} retired ${retierment} years ago.`;
}
}
console.log(yearsUntilRetirement(1954, 'John'));
Its outputting -3. Not sure what to do. Thanks in advance.
I tried ${|firstname|}. That didn't work.