Back to Freecodecamp

Step 3

curriculum/challenges/english/blocks/workshop-loan-qualification-checker/66c8ba975ee7230e29f6c4ad.md

latest2.1 KB
Original Source

--description--

To check which loan a user is qualified for based on the annualIncome and creditScore, you have to use if/else if statement or a ternary right inside the getLoanMessage function. You'll then return the appropriate message in the block of each condition.

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

--hints--

Your getLoanMessage function should return a string.

js
assert.isString(getLoanMessage(65000, 750));
assert.isString(getLoanMessage(60000, 750));
assert.isString(getLoanMessage(65000, 700));
assert.isString(getLoanMessage(60000, 700));

Your getLoanMessage function should return the string "You qualify for a duplex, condo, and car loan.".

js
assert.strictEqual(getLoanMessage(65000, 750), "You qualify for a duplex, condo, and car loan.");
assert.strictEqual(getLoanMessage(60000, 750), "You qualify for a duplex, condo, and car loan.");
assert.strictEqual(getLoanMessage(65000, 700), "You qualify for a duplex, condo, and car loan.");
assert.strictEqual(getLoanMessage(60000, 700), "You qualify for a duplex, condo, and car loan.");

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

js
assert.isUndefined(getLoanMessage(59000, 690));
assert.isUndefined(getLoanMessage(59000, 700));
assert.isUndefined(getLoanMessage(59000, 750));
assert.isUndefined(getLoanMessage(60000, 690));
assert.isUndefined(getLoanMessage(65000, 690));

--seed--

--seed-contents--

js
const minIncomeForDuplex = 60000;
const minCreditScoreForDuplex = 700;

const minIncomeForCondo = 45000;
const minCreditScoreForCondo = 680;

const minIncomeForCar = 30000;
const minCreditScoreForCar = 650;

function getLoanMessage(annualIncome, creditScore) {
--fcc-editable-region--
  
--fcc-editable-region--
}