gpt4 book ai didi

教程

转载 作者:行者123 更新时间:2023-11-30 07:08:47 27 4
gpt4 key购买 nike

我正在做一个关于代码学院的教程,我在这里收到一个错误,说“看起来你的函数没有返回‘唉,你没有资格获得信用卡。资本主义就是这样残酷。’”当收入参数为 75 时。”但是该字符串在控制台中返回(由于某种原因两次)。我把它放在他们的论坛上,但我没有得到任何回应,这里有人有任何建议吗?

var creditCheck = function(income) {
if (income >= 100){
return console.log("You earn a lot of money! You qualify for a credit card.");}
else {
return console.log("Alas you do not qualify for a credit card. Capitalism is cruel like that.");}
};
creditCheck (75);

最佳答案

猜测,您应该返回字符串,而不是返回 console.log("...");

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.";
}
};

关于教程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21019823/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com