Back to Freecodecamp

Step 4

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

latest1.4 KB
Original Source

--description--

If the applicant's annual income is greater than or equal to minIncomeForCondo, AND if their credit score is greater than or equal to minCreditScoreForCondo, then they qualify for a condo and car loan.

Check if that's true in the getLoanMessage function. If it is, return the string "You qualify for a condo and car loan."

--hints--

Your getLoanMessage function should return a string if the applicant qualifies for a condo and car loan.

js
assert.isString(getLoanMessage(45000, 680));

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

js
assert.strictEqual(getLoanMessage(45000, 680), "You qualify for a 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 condo loan.

js
assert.strictEqual(getLoanMessage(45000, 650), undefined);

--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) {
  if(creditScore >= minCreditScoreForDuplex && annualIncome >= minIncomeForDuplex) {
    return "You qualify for a duplex, condo, and car loan."
--fcc-editable-region--
  }
  
--fcc-editable-region--
}