Tell us what’s happening:
Your getLoanMessage function should return undefined if the applicant’s annual income and credit score do not meet the requirements for a duplex loan.
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, minIncomeForDuplex, minCreditScoreForDuplex) {
if (annualIncome >= minIncomeForDuplex && creditScore >= minCreditScoreForDuplex) {
return "You qualify for a duplex, condo, and car loan.";
}
return "You qualify for a duplex, condo, and car loan.";
}
let annualIncome = 50000;
let creditScore = 620;
console.log(getLoanMessage(annualIncome, creditScore, minIncomeForDuplex, minCreditScoreForDuplex))
// 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/138.0.0.0 Safari/537.36
Challenge Information:
Build a Loan Qualification Checker - Step 3
https://www.freecodecamp.org/learn/full-stack-developer/workshop-loan-qualification-checker/step-3
ILM
2
you are always returning a string, when can the function return undefined?
I changed the second string to return undefined but it still displays the same message.
ILM
4
please show your updated code
ILM
6
that is a link to the challenge, I can’t see your updated code there
const minIncomeForDuplex = 60000;
const minCreditScoreForDuplex = 700;
const minIncomeForCondo = 45000;
const minCreditScoreForCondo = 680;
const minIncomeForCar = 30000;
const minCreditScoreForCar = 650;
function getLoanMessage(annualIncome, creditScore, minIncomeForDuplex, minCreditScoreForDuplex) {
if (annualIncome >= minIncomeForDuplex && creditScore >= minCreditScoreForDuplex) {
return "You qualify for a duplex, condo, and car loan.";
}
return undefined;
}
let annualIncome = 60000;
let creditScore = 720;
console.log(getLoanMessage(annualIncome, creditScore, minIncomeForDuplex, minCreditScoreForDuplex))
ILM
8
you have changed the function definition, please reset the step and try again
Alright thanks for the help