What is the output of `Math.max(…[3, 1, 4, 1, 5])`?

JavaScript Developer Easy

JavaScript Developer — Easy

What is the output of `Math.max(…[3, 1, 4, 1, 5])`?

Key points

  • The Math.max function returns the largest of zero or more numbers.
  • The spread operator (...) is used to pass an array as separate arguments.
  • In this case, the largest number in the array [3, 1, 4, 1, 5] is 5.

Ready to go further?

Related questions