我试图让这个switch语句起作用,但我一直得到一个" Uncaught SyntaxError:Unexpected string"错误...我的印象是javascript switch语句可以处理字符串吗?
swtich(opcode)
{
case "A9": loadAccImmediate(); break;
case "AD": loadAccDirect(); break;
case "8D": storeAccInMem(); break;
case "6D": addWithCarry(); break;
case "A2": loadXRegWithConst(); break;
case "AE": loadXRegFromMem(); break;
case "A0": loadYRegWithConst(); break;
case "AC": loadYRegFromMem(); break;
case "EA": noOperation(); break;
case "00": sysBreak(); break;
case "EC": compareXReg(); break;
case "D0": branchXBytes(); break;
case "EE": incByteValue(); break;
case "FF": sysCall(); break;
}
谢谢!
答案 0 :(得分:4)
你拼错了switch
:
swtich(opcode)
↑↑