练习javascript并在if语句中遇到错误

练习javascript并在if语句中遇到错误,javascript,if-statement,Javascript,If Statement,经过3个月的间隙,我再次练习javascript,现在我无法在下面的代码中找到我错的地方 当我从我的历史记录中复制并粘贴相同的代码时,它运行得很好,但这一条写着“SyntaxError:unknown:Unexpected token(18:0)” 有人能指出我的错误吗 function testSize(num) { // Only change code below this line if (num < 5) { return "Ti

经过3个月的间隙,我再次练习javascript,现在我无法在下面的代码中找到我错的地方 当我从我的历史记录中复制并粘贴相同的代码时,它运行得很好,但这一条写着“SyntaxError:unknown:Unexpected token(18:0)” 有人能指出我的错误吗

    function testSize(num) {
      // Only change code below this line
    if (num < 5) {
      return "Tiny";
    } else if (num < 10) {
      return "Small";
    } else if (num < 15) {
      return "Medium";
    } else if (num < 20) {
      return "Large";
    } else {
      return "Huge";
    
  // Only change code above this line
}

testSize(7);
函数testSize(num){
//仅更改此行下方的代码
if(num<5){
返回“微小”;
}否则如果(数值<10){
返回“小”;
}否则如果(数值<15){
返回“中”;
}否则如果(数值<20){
返回“大”;
}否则{
回报“巨大”;
//仅更改此行上方的代码
}
测试尺寸(7);

这应该行得通,您缺少一个括号:

function testSize(num) {
      // Only change code below this line
    if (num < 5) {
      return "Tiny";
    } else if (num < 10) {
      return "Small";
    } else if (num < 15) {
      return "Medium";
    } else if (num < 20) {
      return "Large";
    } else {
      return "Huge";
    }
  // Only change code above this line
}

testSize(7);
函数testSize(num){
//仅更改此行下方的代码
if(num<5){
返回“微小”;
}否则如果(数值<10){
返回“小”;
}否则如果(数值<15){
返回“中”;
}否则如果(数值<20){
返回“大”;
}否则{
回报“巨大”;
}
//仅更改此行上方的代码
}
测试尺寸(7);

结尾处还需要一个结束括号来结束“else”子句。非常感谢,伙计!