Code challenge: howOld() ---- What's wrong with my code?

Here’s my code:

const howOld = (age, year) => {
  let today = new Date();
  let currentYear = today.getFullYear();
  let yearOfBirth = currentYear - age;

  if (year > currentYear) {
    return `You will be ${year-yearOfBrith} in the year ${year}`
  } else if (year < yearOfBirth) {
    `The year ${year} was ${yearOfBrith-year} years before you were born`
  } else {
    `You were ${year-yearOfBrith} in the year ${year}`
  }
}

Would be thankful for your audits

Hey @selmamg2460546621, in your if statements, check the spelling of yearOfBrith.

4 Likes

Thank you! I tend to make many of those