因为 function checkCharType()这个函数没有返回值
所以 switch (checkCharType(myString)) 这里实际是switch ('undefined');
这样改下:
function checkCharType(charToCheck) 

var returnValue ="O"; 
var charCode = charToCheck.charCodeAt(0); 
if (charCode >= "A".charCodeAt(0) && charCode <= "Z".charCodeAt(0)) 

returnValue = "U"; 

else if (charCode >= "a".charCodeAt(0) && charCode <= "z".charCodeAt(0)) 

returnValue = "L"; 

else if (charCode >= "0".charCodeAt(0) && charCode <= "9".charCodeAt(0)) 

returnValue = "N"; 
}
return returnValue; //这里返回一个值