我正在学习Javascript,在将其放入后,会产生一个
SyntaxError: Unexpected token
错误消息。
这是我的代码:
var sleepCheck = function sleepCheck(numHours);
if numHours >= 8
{
return("You're getting plenty of sleep! Maybe even too much!");
} else {
return("Get some more shut eye!");
};
sleepCheck(10);
非常感谢任何帮助,谢谢:)
答案 0 :(得分:0)
您应该阅读有关Javascript语法的内容。
这是我的更正:
var sleepCheck = function(numHours) {
if (numHours >= 8) {
return "You're getting plenty of sleep! Maybe even too much!";
} else {
return "Get some more shut eye!";
}
};
sleepCheck(10);