$ ./guess_the_languageProblem Solving — predict the output
Problem Solving — predict the output · hard · #153

What is the output?

enum E { A = 1, B }
console.log(E.B, E[1]);
  1. 2 A
  2. 1 A
  3. 2 B
  4. 1 B
B auto-increments to 2, and numeric enums also map values back to names.
Play Problem Solving ▸