11.
What will be the output of the following code?
function checkDiscountEligibility(age, membershipStatus) {
if (age >= 60 || membershipStatus === 'Gold') {
return 'Eligible for discounts';
} else {
return 'Not eligible for discounts';
}
}
console.log(checkDiscountEligibility(65, 'Silver'));
undefined
Silver
Not eligible for discounts
Eligible for discounts
Correct: D
The function checkDiscountEligibility takes two parameters: age and membershipStatus. If the age is greater than or equal to 60 OR the membershipStatus is 'Gold', then the function will return "Eligible for discounts". In this case, the age is 65, which is greater than 60, so the condition is true. Therefore, the output will be "Eligible for discounts".