Build a Loan Qualification Checker - Step 3

Tell us what’s happening:

I believe I’ve answered what the step is asking me. This is the error that keeps coming up:

  1. Your getLoanMessage function should return undefined if the applicant’s annual income and credit score do not meet the requirements for a duplex loan.

Since that wasn’t in the original instructions, I am at a loss how to complete this.

Your code so far

const minIncomeForDuplex = 60000;
const minCreditScoreForDuplex = 700;

const minIncomeForCondo = 45000;
const minCreditScoreForCondo = 680;

const minIncomeForCar = 30000;
const minCreditScoreForCar = 650;


// User Editable Region

function getLoanMessage(annualIncome, creditScore) {
  if (annualIncome >= minIncomeForDuplex && creditScore >= minCreditScoreForDuplex);
  return "You qualify for a duplex, condo, and car loan.";
}

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36

Challenge Information:

Build a Loan Qualification Checker - Step 3

The main issue was that you had an extra semicolon right after your if condition. This little semicolon was causing the if statement to do nothing, even if the condition was true. Then, the line that was supposed to return the success message would run every single time, no matter what.

To fix it:

  1. First, you need to remove that extra semicolon that’s sitting at the end of your if condition line.

  2. Second, you need to make sure that the instruction to return the success message is only executed when the if condition is actually true. You do this by logically connecting that return instruction directly to the if statement, so it becomes part of what happens when the condition is met. If the condition isn’t met, that success message shouldn’t be returned, and your function will correctly give no specific return value for that case.

1 Like

It was that extra semicolon, so locked in on having those end a line ha. Will keep that in mind.
Much appreciated, and for the extra information as well.