为此提前道歉(&谢谢)-我确信是我,但如果有其他观点,我会非常感激。
Repl.it有许多JS课堂测试--经过两周的JS学习后,我认为为了it...anyhow,我应该从一开始就开始,当我对他们内置的测试运行我的‘答案’代码时,它们都失败了……尽管看起来满足测试要求。这是我的代码
function doYouPlayTheTheremin(name){
var str = name;
if (str.charAt(0) === 'S' || str.charAt(0) === 's') {
return (str + ' plays the Theremin!');
}
else {
return (str + ' does not play the Theremin!');
}
}repl.it失败的原因如下:
这些测试失败: returns_proper_string_when_1st_char_is_not_an_s returns_a_string_value returns_proper_string_if_1st_char_is_an_S returns_proper_string_if_1st_char_is_an_s
当我检查详细信息选项卡时,它显示:失败的测试,您的程序执行时间太长。确保它没有等待输入,并且没有无限循环。
谁能告诉我我哪里出问题了?提前感谢!!垫子
https://stackoverflow.com/questions/44329186
复制相似问题