Question · JavaScript and TypeScript course · Module 2: Functions, Arrays and Objects

Iteration Basics - reduce() Method

What is the reduce() method on an array used for?

Answer options

  • To remove elements from an array
  • To reduce the size of an array
  • To reduce an array to a single value (e.g., a sum)
  • To sort the array in descending order
Show the answer

Correct answer:

  • To reduce an array to a single value (e.g., a sum)