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

What is the output?

console.log([1, 2, 3].map((x, i, arr) => arr.length));
  1. [3, 3, 3]
  2. [1, 2, 3]
  3. [0, 1, 2]
  4. [3]
The third callback argument is the whole array, whose length is 3 each time.
Play Problem Solving ▸