FreeCodeCampChina / freecodecamp.cn

FCC China open source codebase and curriculum. Learn to code and help nonprofits.

Home Page:https://fcc.asia/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to do this?

zjh1427153003 opened this issue · comments

Challenge Adding a default option in Switch statements has an issue.
User Agent is: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Safari/537.36 Core/1.70.3676.400 QQBrowser/10.4.3505.400.
Please describe how to reproduce this issue, and include links to screenshots if possible.

My code:

function myTest(val) {
  var answer = "";
  // 请把你的代码写在这条注释以下
  switch (val){
    case 1 :
      answer = "apple";
      break;
    case 2 :
      answer = "bird";
      break;
    case 3 :
      answer = "cat";
      break;  
    default :
      answer = "stuff";
  }
  
  
  // 请把你的代码写在这条注释以上
  return answer;  
}

// 你可以修改这一行来测试你的代码
myTest(a);

case "a":
answer = "apple";
break;
case "b":
answer = "bird";
break;
case "c":
answer = "cat";
break;
default:
answer = "stuff";