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

What is the output?

let s = 0;
for (const k in [5, 6]) s += k;
console.log(s);
  1. 11
  2. 01
  3. 0011
  4. 001
for...in yields the indexes as strings '0' and '1', so += concatenates onto 0.
Play Problem Solving ▸