Switch case performance tests

JavaScript performance comparison

Revision 18 of this test case created by Dawid Rogowicz

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
array
const x = 99;
let y;

(([
  () => (y = 0),
  () => (y = 1),
  () => (y = 2),
  () => (y = 3),
  () => (y = 4),
  () => (y = 5),
  () => (y = 6),
  () => (y = 7),
  () => (y = 8),
  () => (y = 9),
  () => (y = 10),
  () => (y = 11),
  () => (y = 12),
  () => (y = 13),
  () => (y = 14),
  () => (y = 15),
  () => (y = 16),
  () => (y = 17),
  () => (y = 18),
  () => (y = 19),
  () => (y = 20),
  () => (y = 21),
  () => (y = 22),
  () => (y = 23),
  () => (y = 24),
  () => (y = 25),
  () => (y = 26),
  () => (y = 27),
  () => (y = 28),
  () => (y = 29),
  () => (y = 30),
  () => (y = 31),
  () => (y = 32),
  () => (y = 33),
  () => (y = 34),
  () => (y = 35),
  () => (y = 36),
  () => (y = 37),
  () => (y = 38),
  () => (y = 39),
  () => (y = 40),
  () => (y = 41),
  () => (y = 42),
  () => (y = 43),
  () => (y = 44),
  () => (y = 45),
  () => (y = 46),
  () => (y = 47),
  () => (y = 48),
  () => (y = 49),
  () => (y = 50),
  () => (y = 51),
  () => (y = 52),
  () => (y = 53),
  () => (y = 54),
  () => (y = 55),
  () => (y = 56),
  () => (y = 57),
  () => (y = 58),
  () => (y = 59),
  () => (y = 60),
  () => (y = 61),
  () => (y = 62),
  () => (y = 63),
  () => (y = 64),
  () => (y = 65),
  () => (y = 66),
  () => (y = 67),
  () => (y = 68),
  () => (y = 69),
  () => (y = 70),
  () => (y = 71),
  () => (y = 72),
  () => (y = 73),
  () => (y = 74),
  () => (y = 75),
  () => (y = 76),
  () => (y = 77),
  () => (y = 78),
  () => (y = 79),
  () => (y = 80),
  () => (y = 81),
  () => (y = 82),
  () => (y = 83),
  () => (y = 84),
  () => (y = 85),
  () => (y = 86),
  () => (y = 87),
  () => (y = 88),
  () => (y = 89),
  () => (y = 90),
  () => (y = 91),
  () => (y = 92),
  () => (y = 93),
  () => (y = 94),
  () => (y = 95),
  () => (y = 96),
  () => (y = 97),
  () => (y = 98),
  () => (y = 99)
])[x])();
pending…
array with primitive data types
const x = 99;
let y;

y = ([
  0,
  1,
  2,
  3,
  4,
  5,
  6,
  7,
  8,
  9,
  10,
  11,
  12,
  13,
  14,
  15,
  16,
  17,
  18,
  19,
  20,
  21,
  22,
  23,
  24,
  25,
  26,
  27,
  28,
  29,
  30,
  31,
  32,
  33,
  34,
  35,
  36,
  37,
  38,
  39,
  40,
  41,
  42,
  43,
  44,
  45,
  46,
  47,
  48,
  49,
  50,
  51,
  52,
  53,
  54,
  55,
  56,
  57,
  58,
  59,
  60,
  61,
  62,
  63,
  64,
  65,
  66,
  67,
  68,
  69,
  70,
  71,
  72,
  73,
  74,
  75,
  76,
  77,
  78,
  79,
  80,
  81,
  82,
  83,
  84,
  85,
  86,
  87,
  88,
  89,
  90,
  91,
  92,
  93,
  94,
  95,
  96,
  97,
  98,
  99
])[x];
pending…
string switch
const x = "99";
let y;

switch (x) {
  case "0":
    y = 0;
    break;
  case "1":
    y = 1;
    break;
  case "2":
    y = 2;
    break;
  case "3":
    y = 3;
    break;
  case "4":
    y = 4;
    break;
  case "5":
    y = 5;
    break;
  case "6":
    y = 6;
    break;
  case "7":
    y = 7;
    break;
  case "8":
    y = 8;
    break;
  case "9":
    y = 9;
    break;
  case "10":
    y = 10;
    break;
  case "11":
    y = 11;
    break;
  case "12":
    y = 12;
    break;
  case "13":
    y = 13;
    break;
  case "14":
    y = 14;
    break;
  case "15":
    y = 15;
    break;
  case "16":
    y = 16;
    break;
  case "17":
    y = 17;
    break;
  case "18":
    y = 18;
    break;
  case "19":
    y = 19;
    break;
  case "20":
    y = 20;
    break;
  case "21":
    y = 21;
    break;
  case "22":
    y = 22;
    break;
  case "23":
    y = 23;
    break;
  case "24":
    y = 24;
    break;
  case "25":
    y = 25;
    break;
  case "26":
    y = 26;
    break;
  case "27":
    y = 27;
    break;
  case "28":
    y = 28;
    break;
  case "29":
    y = 29;
    break;
  case "30":
    y = 30;
    break;
  case "31":
    y = 31;
    break;
  case "32":
    y = 32;
    break;
  case "33":
    y = 33;
    break;
  case "34":
    y = 34;
    break;
  case "35":
    y = 35;
    break;
  case "36":
    y = 36;
    break;
  case "37":
    y = 37;
    break;
  case "38":
    y = 38;
    break;
  case "39":
    y = 39;
    break;
  case "40":
    y = 40;
    break;
  case "41":
    y = 41;
    break;
  case "42":
    y = 42;
    break;
  case "43":
    y = 43;
    break;
  case "44":
    y = 44;
    break;
  case "45":
    y = 45;
    break;
  case "46":
    y = 46;
    break;
  case "47":
    y = 47;
    break;
  case "48":
    y = 48;
    break;
  case "49":
    y = 49;
    break;
  case "50":
    y = 50;
    break;
  case "51":
    y = 51;
    break;
  case "52":
    y = 52;
    break;
  case "53":
    y = 53;
    break;
  case "54":
    y = 54;
    break;
  case "55":
    y = 55;
    break;
  case "56":
    y = 56;
    break;
  case "57":
    y = 57;
    break;
  case "58":
    y = 58;
    break;
  case "59":
    y = 59;
    break;
  case "60":
    y = 60;
    break;
  case "61":
    y = 61;
    break;
  case "62":
    y = 62;
    break;
  case "63":
    y = 63;
    break;
  case "64":
    y = 64;
    break;
  case "65":
    y = 65;
    break;
  case "66":
    y = 66;
    break;
  case "67":
    y = 67;
    break;
  case "68":
    y = 68;
    break;
  case "69":
    y = 69;
    break;
  case "70":
    y = 70;
    break;
  case "71":
    y = 71;
    break;
  case "72":
    y = 72;
    break;
  case "73":
    y = 73;
    break;
  case "74":
    y = 74;
    break;
  case "75":
    y = 75;
    break;
  case "76":
    y = 76;
    break;
  case "77":
    y = 77;
    break;
  case "78":
    y = 78;
    break;
  case "79":
    y = 79;
    break;
  case "80":
    y = 80;
    break;
  case "81":
    y = 81;
    break;
  case "82":
    y = 82;
    break;
  case "83":
    y = 83;
    break;
  case "84":
    y = 84;
    break;
  case "85":
    y = 85;
    break;
  case "86":
    y = 86;
    break;
  case "87":
    y = 87;
    break;
  case "88":
    y = 88;
    break;
  case "89":
    y = 89;
    break;
  case "90":
    y = 90;
    break;
  case "91":
    y = 91;
    break;
  case "92":
    y = 92;
    break;
  case "93":
    y = 93;
    break;
  case "94":
    y = 94;
    break;
  case "95":
    y = 95;
    break;
  case "96":
    y = 96;
    break;
  case "97":
    y = 97;
    break;
  case "98":
    y = 98;
    break;
  case "99":
    y = 99;
    break;
}
pending…
return numeric switch
const x = 99;
let y;

switch (x) {
  case 0:
    return y = 0;
  case 1:
    return y = 1;
  case 2:
    return y = 2;
  case 3:
    return y = 3;
  case 4:
    return y = 4;
  case 5:
    return y = 5;
  case 6:
    return y = 6;
  case 7:
    return y = 7;
  case 8:
    return y = 8;
  case 9:
    return y = 9;
  case 10:
    return y = 10;
  case 11:
    return y = 11;
  case 12:
    return y = 12;
  case 13:
    return y = 13;
  case 14:
    return y = 14;
  case 15:
    return y = 15;
  case 16:
    return y = 16;
  case 17:
    return y = 17;
  case 18:
    return y = 18;
  case 19:
    return y = 19;
  case 20:
    return y = 20;
  case 21:
    return y = 21;
  case 22:
    return y = 22;
  case 23:
    return y = 23;
  case 24:
    return y = 24;
  case 25:
    return y = 25;
  case 26:
    return y = 26;
  case 27:
    return y = 27;
  case 28:
    return y = 28;
  case 29:
    return y = 29;
  case 30:
    return y = 30;
  case 31:
    return y = 31;
  case 32:
    return y = 32;
  case 33:
    return y = 33;
  case 34:
    return y = 34;
  case 35:
    return y = 35;
  case 36:
    return y = 36;
  case 37:
    return y = 37;
  case 38:
    return y = 38;
  case 39:
    return y = 39;
  case 40:
    return y = 40;
  case 41:
    return y = 41;
  case 42:
    return y = 42;
  case 43:
    return y = 43;
  case 44:
    return y = 44;
  case 45:
    return y = 45;
  case 46:
    return y = 46;
  case 47:
    return y = 47;
  case 48:
    return y = 48;
  case 49:
    return y = 49;
  case 50:
    return y = 50;
  case 51:
    return y = 51;
  case 52:
    return y = 52;
  case 53:
    return y = 53;
  case 54:
    return y = 54;
  case 55:
    return y = 55;
  case 56:
    return y = 56;
  case 57:
    return y = 57;
  case 58:
    return y = 58;
  case 59:
    return y = 59;
  case 60:
    return y = 60;
  case 61:
    return y = 61;
  case 62:
    return y = 62;
  case 63:
    return y = 63;
  case 64:
    return y = 64;
  case 65:
    return y = 65;
  case 66:
    return y = 66;
  case 67:
    return y = 67;
  case 68:
    return y = 68;
  case 69:
    return y = 69;
  case 70:
    return y = 70;
  case 71:
    return y = 71;
  case 72:
    return y = 72;
  case 73:
    return y = 73;
  case 74:
    return y = 74;
  case 75:
    return y = 75;
  case 76:
    return y = 76;
  case 77:
    return y = 77;
  case 78:
    return y = 78;
  case 79:
    return y = 79;
  case 80:
    return y = 80;
  case 81:
    return y = 81;
  case 82:
    return y = 82;
  case 83:
    return y = 83;
  case 84:
    return y = 84;
  case 85:
    return y = 85;
  case 86:
    return y = 86;
  case 87:
    return y = 87;
  case 88:
    return y = 88;
  case 89:
    return y = 89;
  case 90:
    return y = 90;
  case 91:
    return y = 91;
  case 92:
    return y = 92;
  case 93:
    return y = 93;
  case 94:
    return y = 94;
  case 95:
    return y = 95;
  case 96:
    return y = 96;
  case 97:
    return y = 97;
  case 98:
    return y = 98;
  case 99:
    return y = 99;
}
pending…
if else
const x = 99;
let y;

if (x === 0) {
  y = 0;
}
else if (x === 1) {
  y = 1;
}
else if (x === 2) {
  y = 2;
}
else if (x === 3) {
  y = 3;
}
else if (x === 4) {
  y = 4;
}
else if (x === 5) {
  y = 5;
}
else if (x === 6) {
  y = 6;
}
else if (x === 7) {
  y = 7;
}
else if (x === 8) {
  y = 8;
}
else if (x === 9) {
  y = 9;
}
else if (x === 10) {
  y = 10;
}
else if (x === 11) {
  y = 11;
}
else if (x === 12) {
  y = 12;
}
else if (x === 13) {
  y = 13;
}
else if (x === 14) {
  y = 14;
}
else if (x === 15) {
  y = 15;
}
else if (x === 16) {
  y = 16;
}
else if (x === 17) {
  y = 17;
}
else if (x === 18) {
  y = 18;
}
else if (x === 19) {
  y = 19;
}
else if (x === 20) {
  y = 20;
}
else if (x === 21) {
  y = 21;
}
else if (x === 22) {
  y = 22;
}
else if (x === 23) {
  y = 23;
}
else if (x === 24) {
  y = 24;
}
else if (x === 25) {
  y = 25;
}
else if (x === 26) {
  y = 26;
}
else if (x === 27) {
  y = 27;
}
else if (x === 28) {
  y = 28;
}
else if (x === 29) {
  y = 29;
}
else if (x === 30) {
  y = 30;
}
else if (x === 31) {
  y = 31;
}
else if (x === 32) {
  y = 32;
}
else if (x === 33) {
  y = 33;
}
else if (x === 34) {
  y = 34;
}
else if (x === 35) {
  y = 35;
}
else if (x === 36) {
  y = 36;
}
else if (x === 37) {
  y = 37;
}
else if (x === 38) {
  y = 38;
}
else if (x === 39) {
  y = 39;
}
else if (x === 40) {
  y = 40;
}
else if (x === 41) {
  y = 41;
}
else if (x === 42) {
  y = 42;
}
else if (x === 43) {
  y = 43;
}
else if (x === 44) {
  y = 44;
}
else if (x === 45) {
  y = 45;
}
else if (x === 46) {
  y = 46;
}
else if (x === 47) {
  y = 47;
}
else if (x === 48) {
  y = 48;
}
else if (x === 49) {
  y = 49;
}
else if (x === 50) {
  y = 50;
}
else if (x === 51) {
  y = 51;
}
else if (x === 52) {
  y = 52;
}
else if (x === 53) {
  y = 53;
}
else if (x === 54) {
  y = 54;
}
else if (x === 55) {
  y = 55;
}
else if (x === 56) {
  y = 56;
}
else if (x === 57) {
  y = 57;
}
else if (x === 58) {
  y = 58;
}
else if (x === 59) {
  y = 59;
}
else if (x === 60) {
  y = 60;
}
else if (x === 61) {
  y = 61;
}
else if (x === 62) {
  y = 62;
}
else if (x === 63) {
  y = 63;
}
else if (x === 64) {
  y = 64;
}
else if (x === 65) {
  y = 65;
}
else if (x === 66) {
  y = 66;
}
else if (x === 67) {
  y = 67;
}
else if (x === 68) {
  y = 68;
}
else if (x === 69) {
  y = 69;
}
else if (x === 70) {
  y = 70;
}
else if (x === 71) {
  y = 71;
}
else if (x === 72) {
  y = 72;
}
else if (x === 73) {
  y = 73;
}
else if (x === 74) {
  y = 74;
}
else if (x === 75) {
  y = 75;
}
else if (x === 76) {
  y = 76;
}
else if (x === 77) {
  y = 77;
}
else if (x === 78) {
  y = 78;
}
else if (x === 79) {
  y = 79;
}
else if (x === 80) {
  y = 80;
}
else if (x === 81) {
  y = 81;
}
else if (x === 82) {
  y = 82;
}
else if (x === 83) {
  y = 83;
}
else if (x === 84) {
  y = 84;
}
else if (x === 85) {
  y = 85;
}
else if (x === 86) {
  y = 86;
}
else if (x === 87) {
  y = 87;
}
else if (x === 88) {
  y = 88;
}
else if (x === 89) {
  y = 89;
}
else if (x === 90) {
  y = 90;
}
else if (x === 91) {
  y = 91;
}
else if (x === 92) {
  y = 92;
}
else if (x === 93) {
  y = 93;
}
else if (x === 94) {
  y = 94;
}
else if (x === 95) {
  y = 95;
}
else if (x === 96) {
  y = 96;
}
else if (x === 97) {
  y = 97;
}
else if (x === 98) {
  y = 98;
}
else if (x === 99) {
  y = 99;
}
pending…
switch with primitives
const x = 99;
let y;

function getY() {
  switch (x) {
    case 0:
      return 0;
    case 1:
      return 1;
    case 2:
      return 2;
    case 3:
      return 3;
    case 4:
      return 4;
    case 5:
      return 5;
    case 6:
      return 6;
    case 7:
      return 7;
    case 8:
      return 8;
    case 9:
      return 9;
    case 10:
      return 10;
    case 11:
      return 11;
    case 12:
      return 12;
    case 13:
      return 13;
    case 14:
      return 14;
    case 15:
      return 15;
    case 16:
      return 16;
    case 17:
      return 17;
    case 18:
      return 18;
    case 19:
      return 19;
    case 20:
      return 20;
    case 21:
      return 21;
    case 22:
      return 22;
    case 23:
      return 23;
    case 24:
      return 24;
    case 25:
      return 25;
    case 26:
      return 26;
    case 27:
      return 27;
    case 28:
      return 28;
    case 29:
      return 29;
    case 30:
      return 30;
    case 31:
      return 31;
    case 32:
      return 32;
    case 33:
      return 33;
    case 34:
      return 34;
    case 35:
      return 35;
    case 36:
      return 36;
    case 37:
      return 37;
    case 38:
      return 38;
    case 39:
      return 39;
    case 40:
      return 40;
    case 41:
      return 41;
    case 42:
      return 42;
    case 43:
      return 43;
    case 44:
      return 44;
    case 45:
      return 45;
    case 46:
      return 46;
    case 47:
      return 47;
    case 48:
      return 48;
    case 49:
      return 49;
    case 50:
      return 50;
    case 51:
      return 51;
    case 52:
      return 52;
    case 53:
      return 53;
    case 54:
      return 54;
    case 55:
      return 55;
    case 56:
      return 56;
    case 57:
      return 57;
    case 58:
      return 58;
    case 59:
      return 59;
    case 60:
      return 60;
    case 61:
      return 61;
    case 62:
      return 62;
    case 63:
      return 63;
    case 64:
      return 64;
    case 65:
      return 65;
    case 66:
      return 66;
    case 67:
      return 67;
    case 68:
      return 68;
    case 69:
      return 69;
    case 70:
      return 70;
    case 71:
      return 71;
    case 72:
      return 72;
    case 73:
      return 73;
    case 74:
      return 74;
    case 75:
      return 75;
    case 76:
      return 76;
    case 77:
      return 77;
    case 78:
      return 78;
    case 79:
      return 79;
    case 80:
      return 80;
    case 81:
      return 81;
    case 82:
      return 82;
    case 83:
      return 83;
    case 84:
      return 84;
    case 85:
      return 85;
    case 86:
      return 86;
    case 87:
      return 87;
    case 88:
      return 88;
    case 89:
      return 89;
    case 90:
      return 90;
    case 91:
      return 91;
    case 92:
      return 92;
    case 93:
      return 93;
    case 94:
      return 94;
    case 95:
      return 95;
    case 96:
      return 96;
    case 97:
      return 97;
    case 98:
      return 98;
    case 99:
      return 99;
  }
}

y = getY();
pending…
numeric switch
const x = 99;
let y;

switch (x) {
  case 0:
    y = 0;
    break;
  case 1:
    y = 1;
    break;
  case 2:
    y = 2;
    break;
  case 3:
    y = 3;
    break;
  case 4:
    y = 4;
    break;
  case 5:
    y = 5;
    break;
  case 6:
    y = 6;
    break;
  case 7:
    y = 7;
    break;
  case 8:
    y = 8;
    break;
  case 9:
    y = 9;
    break;
  case 10:
    y = 10;
    break;
  case 11:
    y = 11;
    break;
  case 12:
    y = 12;
    break;
  case 13:
    y = 13;
    break;
  case 14:
    y = 14;
    break;
  case 15:
    y = 15;
    break;
  case 16:
    y = 16;
    break;
  case 17:
    y = 17;
    break;
  case 18:
    y = 18;
    break;
  case 19:
    y = 19;
    break;
  case 20:
    y = 20;
    break;
  case 21:
    y = 21;
    break;
  case 22:
    y = 22;
    break;
  case 23:
    y = 23;
    break;
  case 24:
    y = 24;
    break;
  case 25:
    y = 25;
    break;
  case 26:
    y = 26;
    break;
  case 27:
    y = 27;
    break;
  case 28:
    y = 28;
    break;
  case 29:
    y = 29;
    break;
  case 30:
    y = 30;
    break;
  case 31:
    y = 31;
    break;
  case 32:
    y = 32;
    break;
  case 33:
    y = 33;
    break;
  case 34:
    y = 34;
    break;
  case 35:
    y = 35;
    break;
  case 36:
    y = 36;
    break;
  case 37:
    y = 37;
    break;
  case 38:
    y = 38;
    break;
  case 39:
    y = 39;
    break;
  case 40:
    y = 40;
    break;
  case 41:
    y = 41;
    break;
  case 42:
    y = 42;
    break;
  case 43:
    y = 43;
    break;
  case 44:
    y = 44;
    break;
  case 45:
    y = 45;
    break;
  case 46:
    y = 46;
    break;
  case 47:
    y = 47;
    break;
  case 48:
    y = 48;
    break;
  case 49:
    y = 49;
    break;
  case 50:
    y = 50;
    break;
  case 51:
    y = 51;
    break;
  case 52:
    y = 52;
    break;
  case 53:
    y = 53;
    break;
  case 54:
    y = 54;
    break;
  case 55:
    y = 55;
    break;
  case 56:
    y = 56;
    break;
  case 57:
    y = 57;
    break;
  case 58:
    y = 58;
    break;
  case 59:
    y = 59;
    break;
  case 60:
    y = 60;
    break;
  case 61:
    y = 61;
    break;
  case 62:
    y = 62;
    break;
  case 63:
    y = 63;
    break;
  case 64:
    y = 64;
    break;
  case 65:
    y = 65;
    break;
  case 66:
    y = 66;
    break;
  case 67:
    y = 67;
    break;
  case 68:
    y = 68;
    break;
  case 69:
    y = 69;
    break;
  case 70:
    y = 70;
    break;
  case 71:
    y = 71;
    break;
  case 72:
    y = 72;
    break;
  case 73:
    y = 73;
    break;
  case 74:
    y = 74;
    break;
  case 75:
    y = 75;
    break;
  case 76:
    y = 76;
    break;
  case 77:
    y = 77;
    break;
  case 78:
    y = 78;
    break;
  case 79:
    y = 79;
    break;
  case 80:
    y = 80;
    break;
  case 81:
    y = 81;
    break;
  case 82:
    y = 82;
    break;
  case 83:
    y = 83;
    break;
  case 84:
    y = 84;
    break;
  case 85:
    y = 85;
    break;
  case 86:
    y = 86;
    break;
  case 87:
    y = 87;
    break;
  case 88:
    y = 88;
    break;
  case 89:
    y = 89;
    break;
  case 90:
    y = 90;
    break;
  case 91:
    y = 91;
    break;
  case 92:
    y = 92;
    break;
  case 93:
    y = 93;
    break;
  case 94:
    y = 94;
    break;
  case 95:
    y = 95;
    break;
  case 96:
    y = 96;
    break;
  case 97:
    y = 97;
    break;
  case 98:
    y = 98;
    break;
  case 99:
    y = 99;
    break;
}
pending…
object mapping
const x = "99";
let y;

(({
  "0": () => (y = 0),
  "1": () => (y = 1),
  "2": () => (y = 2),
  "3": () => (y = 3),
  "4": () => (y = 4),
  "5": () => (y = 5),
  "6": () => (y = 6),
  "7": () => (y = 7),
  "8": () => (y = 8),
  "9": () => (y = 9),
  "10": () => (y = 10),
  "11": () => (y = 11),
  "12": () => (y = 12),
  "13": () => (y = 13),
  "14": () => (y = 14),
  "15": () => (y = 15),
  "16": () => (y = 16),
  "17": () => (y = 17),
  "18": () => (y = 18),
  "19": () => (y = 19),
  "20": () => (y = 20),
  "21": () => (y = 21),
  "22": () => (y = 22),
  "23": () => (y = 23),
  "24": () => (y = 24),
  "25": () => (y = 25),
  "26": () => (y = 26),
  "27": () => (y = 27),
  "28": () => (y = 28),
  "29": () => (y = 29),
  "30": () => (y = 30),
  "31": () => (y = 31),
  "32": () => (y = 32),
  "33": () => (y = 33),
  "34": () => (y = 34),
  "35": () => (y = 35),
  "36": () => (y = 36),
  "37": () => (y = 37),
  "38": () => (y = 38),
  "39": () => (y = 39),
  "40": () => (y = 40),
  "41": () => (y = 41),
  "42": () => (y = 42),
  "43": () => (y = 43),
  "44": () => (y = 44),
  "45": () => (y = 45),
  "46": () => (y = 46),
  "47": () => (y = 47),
  "48": () => (y = 48),
  "49": () => (y = 49),
  "50": () => (y = 50),
  "51": () => (y = 51),
  "52": () => (y = 52),
  "53": () => (y = 53),
  "54": () => (y = 54),
  "55": () => (y = 55),
  "56": () => (y = 56),
  "57": () => (y = 57),
  "58": () => (y = 58),
  "59": () => (y = 59),
  "60": () => (y = 60),
  "61": () => (y = 61),
  "62": () => (y = 62),
  "63": () => (y = 63),
  "64": () => (y = 64),
  "65": () => (y = 65),
  "66": () => (y = 66),
  "67": () => (y = 67),
  "68": () => (y = 68),
  "69": () => (y = 69),
  "70": () => (y = 70),
  "71": () => (y = 71),
  "72": () => (y = 72),
  "73": () => (y = 73),
  "74": () => (y = 74),
  "75": () => (y = 75),
  "76": () => (y = 76),
  "77": () => (y = 77),
  "78": () => (y = 78),
  "79": () => (y = 79),
  "80": () => (y = 80),
  "81": () => (y = 81),
  "82": () => (y = 82),
  "83": () => (y = 83),
  "84": () => (y = 84),
  "85": () => (y = 85),
  "86": () => (y = 86),
  "87": () => (y = 87),
  "88": () => (y = 88),
  "89": () => (y = 89),
  "90": () => (y = 90),
  "91": () => (y = 91),
  "92": () => (y = 92),
  "93": () => (y = 93),
  "94": () => (y = 94),
  "95": () => (y = 95),
  "96": () => (y = 96),
  "97": () => (y = 97),
  "98": () => (y = 98),
  "99": () => (y = 99)
})[x])();
pending…
ifs
const x = 99;
let y;

if (x === 0) {
  y = 0;
}
if (x === 1) {
  y = 1;
}
if (x === 2) {
  y = 2;
}
if (x === 3) {
  y = 3;
}
if (x === 4) {
  y = 4;
}
if (x === 5) {
  y = 5;
}
if (x === 6) {
  y = 6;
}
if (x === 7) {
  y = 7;
}
if (x === 8) {
  y = 8;
}
if (x === 9) {
  y = 9;
}
if (x === 10) {
  y = 10;
}
if (x === 11) {
  y = 11;
}
if (x === 12) {
  y = 12;
}
if (x === 13) {
  y = 13;
}
if (x === 14) {
  y = 14;
}
if (x === 15) {
  y = 15;
}
if (x === 16) {
  y = 16;
}
if (x === 17) {
  y = 17;
}
if (x === 18) {
  y = 18;
}
if (x === 19) {
  y = 19;
}
if (x === 20) {
  y = 20;
}
if (x === 21) {
  y = 21;
}
if (x === 22) {
  y = 22;
}
if (x === 23) {
  y = 23;
}
if (x === 24) {
  y = 24;
}
if (x === 25) {
  y = 25;
}
if (x === 26) {
  y = 26;
}
if (x === 27) {
  y = 27;
}
if (x === 28) {
  y = 28;
}
if (x === 29) {
  y = 29;
}
if (x === 30) {
  y = 30;
}
if (x === 31) {
  y = 31;
}
if (x === 32) {
  y = 32;
}
if (x === 33) {
  y = 33;
}
if (x === 34) {
  y = 34;
}
if (x === 35) {
  y = 35;
}
if (x === 36) {
  y = 36;
}
if (x === 37) {
  y = 37;
}
if (x === 38) {
  y = 38;
}
if (x === 39) {
  y = 39;
}
if (x === 40) {
  y = 40;
}
if (x === 41) {
  y = 41;
}
if (x === 42) {
  y = 42;
}
if (x === 43) {
  y = 43;
}
if (x === 44) {
  y = 44;
}
if (x === 45) {
  y = 45;
}
if (x === 46) {
  y = 46;
}
if (x === 47) {
  y = 47;
}
if (x === 48) {
  y = 48;
}
if (x === 49) {
  y = 49;
}
if (x === 50) {
  y = 50;
}
if (x === 51) {
  y = 51;
}
if (x === 52) {
  y = 52;
}
if (x === 53) {
  y = 53;
}
if (x === 54) {
  y = 54;
}
if (x === 55) {
  y = 55;
}
if (x === 56) {
  y = 56;
}
if (x === 57) {
  y = 57;
}
if (x === 58) {
  y = 58;
}
if (x === 59) {
  y = 59;
}
if (x === 60) {
  y = 60;
}
if (x === 61) {
  y = 61;
}
if (x === 62) {
  y = 62;
}
if (x === 63) {
  y = 63;
}
if (x === 64) {
  y = 64;
}
if (x === 65) {
  y = 65;
}
if (x === 66) {
  y = 66;
}
if (x === 67) {
  y = 67;
}
if (x === 68) {
  y = 68;
}
if (x === 69) {
  y = 69;
}
if (x === 70) {
  y = 70;
}
if (x === 71) {
  y = 71;
}
if (x === 72) {
  y = 72;
}
if (x === 73) {
  y = 73;
}
if (x === 74) {
  y = 74;
}
if (x === 75) {
  y = 75;
}
if (x === 76) {
  y = 76;
}
if (x === 77) {
  y = 77;
}
if (x === 78) {
  y = 78;
}
if (x === 79) {
  y = 79;
}
if (x === 80) {
  y = 80;
}
if (x === 81) {
  y = 81;
}
if (x === 82) {
  y = 82;
}
if (x === 83) {
  y = 83;
}
if (x === 84) {
  y = 84;
}
if (x === 85) {
  y = 85;
}
if (x === 86) {
  y = 86;
}
if (x === 87) {
  y = 87;
}
if (x === 88) {
  y = 88;
}
if (x === 89) {
  y = 89;
}
if (x === 90) {
  y = 90;
}
if (x === 91) {
  y = 91;
}
if (x === 92) {
  y = 92;
}
if (x === 93) {
  y = 93;
}
if (x === 94) {
  y = 94;
}
if (x === 95) {
  y = 95;
}
if (x === 96) {
  y = 96;
}
if (x === 97) {
  y = 97;
}
if (x === 98) {
  y = 98;
}
if (x === 99) {
  y = 99;
}
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL.

0 Comments