Tell us what’s happening:
I give up
. I’ve been trying for ages to find a way to return the second statement. The code runs, obviously, but it’s not correct. I need a skiffy (hint)
.
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
let annualIncome = "80000";
let creditScore = "900";
function getLoanMessage(annualIncome, creditScore) {
return "You qualify for a duplex, condo, and car loan.";
} if (annualIncome >= minIncomeForDuplex && creditScore >= minCreditScoreForDuplex) {
console.log(getLoanMessage());
} else {
console.log("undefined");
}
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.2 Safari/605.1.15
Challenge Information:
Build a Loan Qualification Checker - Step 3
Hi.
“annualIncome” and “creditScore” are already declared as a type of variable within the parameters of the function. No need to hard code values (you need to be able to pass any value to the function).
Your code stopped running before your if statement as you put the return statement first.
Your if statement should return the requested statement so it should go inside the if statement.
There is nothing to return if the condition is false so no need for an else statement.
Ah, I think I get what you mean, a1, though not entirely sure I’ll be able to implement it
. I’ll mess about with it and let you know how it goes. Thank you very much for the response.x
Hi @Davie_Smith
By hard coding values I meant no need to add this:
let annualIncome = “80000”;
let creditScore = “900”;
I suggest you have a look at a basic article on functions, how they work, the parameters, how they are called. The values get passed to the function, via the parameters, when the function is called.
Your if statement should go inside the function, I see you put yours after the function.
Please reply to this thread if you have further questions. Update your code with 3 backticks before and after the block of code
1 Like
WOW! 3 lines of code. I feel like crying
.
Thanks again, a1legalfreelannce, you are a star.x
1 Like