我刚开始编程,我可以让这段代码更短吗?也许有一个数组?谢谢。
function createDragName1(){
var firstName;
var random1 = Math.floor((Math.random()*17)+0);
var name1 = "va";
var name2 = "tuul";
switch(random1){
case 0:
firstName = name1;
break;
case 1:
firstName = name2;
break;
default:
firstName = "Error";
}
var testingName = firstName.substring(0,1).toUpperCase()+firstName.substring(1,6);
return(testingName);
}