tableSwitchConst.js (280B)
1 function f() { 2 switch(2) { 3 case 1: return 1; 4 case 2: return 2; 5 default: return -1; 6 } 7 } 8 assertEq(f(), 2); 9 10 function g() { 11 switch(3.14) { 12 case 3: return 3; 13 case 4: return 4; 14 default: return -1; 15 } 16 } 17 assertEq(g(), -1);