A

Admin • 833K Points
Coach

Q. What will this return?

Code:
[1, 2, 3].reduce((a, b) => a + b);
  • (A) 6
  • (B) 1
  • (C) [1, 2, 3]
  • (D) Error
  • Correct Answer - Option(A)
  • Views: 18
  • Filed under category JavaScript
  • Hashtags:

Explanation by: Admin

reduce sums the elements: 1 + 2 + 3 = 6.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.