// function expression
const calcAge1 = function (birthYear) {
  return new Date().getFullYear() - birthYear;
};

console.log(calcAge1(1986));

// arrow function
const calcAge2 = birthYear => new Date().getFullYear() - birthYear;
console.log(calcAge2(1986));

const yearsUntilRetirement = (birthYear, firstName) => {
  //   const age = new Date().getFullYear() - birthYear;
  const age = calcAge2(birthYear);
  const retirement = 65 - age;
  return `${firstName} retires in ${retirement} years`;
};

console.log(yearsUntilRetirement(1986, "David Aster"));
