无法弄清楚这个switch语句有什么问题

时间:2012-09-27 04:42:47

标签: javascript

我试图让这个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;
    }

谢谢!

1 个答案:

答案 0 :(得分:4)

你拼错了switch

swtich(opcode)
  ↑↑