Build a Loan Qualification Checker - Step 5

Tell us what’s happening:

What is the issue with my code
I did everything as was asked but am so confused on why it does not work .

if (annualIncome >= minIncomeForCar && creditScore >= minIncomeForCar) {
return “You qualify for a car loan.”
}
console.log(getLoanMessage(32000, 650));
console.log(getLoanMessage(25000, 550));

Your code so far

const minIncomeForDuplex = 60000;
const minCreditScoreForDuplex = 700;

const minIncomeForCondo = 45000;
const minCreditScoreForCondo = 680;

const minIncomeForCar = 30000;
const minCreditScoreForCar = 650;

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

// User Editable Region

  } 
  if (annualIncome >= minIncomeForCar && creditScore >= minIncomeForCar) {
  return "You qualify for a car loan."
  }
  console.log(getLoanMessage(32000, 650));
  console.log(getLoanMessage(25000, 550));

// 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/139.0.0.0 Safari/537.36

Challenge Information:

Build a Loan Qualification Checker - Step 5
https://www.freecodecamp.org/learn/full-stack-developer/workshop-loan-qualification-checker/step-5

It’s not entirely clear from the instructions but you are in the middle of building a big if/ else if structure.

if (this) {
    do that 
} else if (that) {
    do this 
} else if (another thing) {
    etc
}

You can use as many else if’s as you need.

I think, that the freeCodeCamp platform wants you to use very specific syntax to pass the tests. Please try giving your last bit of code another good look, paying close attention to your if/else statement syntax consistency with your previous if/else statements. Cheers!

You have made 3 mistakes
here:
else if (annualIncome >= minIncomeForCar && creditScore >= minIncomeForCar) {
return “You qualify for a car loan.”
}

  • It should be minCreditScoreForCar.

  • Another mistake you made is with the syntax in else if; you have written only if.

  • Remove console, it is not needed right now