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

What is the output?

const x = [10, 20, 30];
console.log(x.reduce((a, b) => a + b, 0));
  1. 60
  2. 102030
  3. 30
  4. 0
reduce sums all elements starting from 0, giving 60.
Play Problem Solving ▸