我一直收到这个错误: - 看起来你的功能没有返回'唉你没资格获得信用卡。资本主义是残酷的。“当收入参数为75时。
有人可以告诉我我做错了什么吗?干杯:)
var creditCheck = function(income)
if(income >= 100)
{
return "You earn a lot of money! You qualify for a credit card.";
}
else
{
return "Alas you do not qualify for a credit card. Capitalism is cruel like that.";
}
creditCheck(75);
creditCheck(125);
creditCheck(100);
答案 0 :(得分:2)
var creditCheck = function(income) {
if(income >= 100) {
return "You earn a lot of money! You qualify for a credit card.";
} else {
return "Alas you do not qualify for a credit card. Capitalism is cruel like that.";
}
};
此外,您正在返回一个字符串,您还没有将它打印到屏幕或控制台,或者您什么也看不见。
答案 1 :(得分:1)
如何打开和关闭该功能:
var creditCheck = function (income) {
if (income >= 100) {
return "You earn a lot of money! You qualify for a credit card.";
} else {
return "Alas you do not qualify for a credit card. Capitalism is cruel like that.";
}
}