Build a Loan Qualification Checker - Step 3

Tell us what’s happening:

Hello, there please could you tell me what is wrong with my code, thank you.

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 loan.";

  } else if (annualIncome >= minIncomeForCondo &&  creditScore >= minCreditScoreForCondo){
    return "You qualify for a condo loan.";

  } else if (annualIncome >= minIncomeForCar && creditScore >= minCreditScoreForCar){
    return "You qualify for a car loan.";

  } else {
    return undefined;
  }
  

}


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

Challenge Information:

Build a Loan Qualification Checker - Step 3

Hi and welcome to the forum :wave:

Read the instructions a bit more carefully and do only what they say.

return the string "You qualify for a duplex, condo, and car loan."

The instructions only give 1 condition and this response. Just follow the steps exactly and don’t do anything more, you’ll likely do the other conditions in future steps.

Hi there. You didn’t need to add extra code.

I just did what you said , but it does not working

Post your latest code here in your next reply.

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

} else if (annualIncome >= minIncomeForCondo && creditScore >= minCreditScoreForCondo){
return “You qualify for a duplex, condo, and car loan.”;

} else if (annualIncome >= minIncomeForCar && creditScore >= minCreditScoreForCar){
return “You qualify for a duplex, condo, and car loan.”;

} else {
return undefined;
}

}

Read the instructions carefully. It’s only asking for: Starting with the duplex loan, check if annualIncome is greater than or equal to minIncomeForDuplex AND if creditScore is greater than or equal to minCreditScoreForDuplex.

If that condition is true, then the applicant is eligible for a duplex loan and the other loans. So, inside the check, return the string "You qualify for a duplex, condo, and car loan."

You done the job in first block.

That’s unnecessary and duplicate conditions and returning statement

I see now what do you mean , the solution was here
Starting with the duplex loan, check if annualIncome is greater than or equal to minIncomeForDuplex AND if creditScore is greater than or equal to minCreditScoreForDuplex .

thank you , for being there for us I appreciate it

1 Like