LearnFrenzy
Sign in Take a free test

Spread and Rest Operators · Spread and Rest MCQ · Question 1

Spread or rest? Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 1 Back to Exercise

In function total(...prices) { return Math.max(...prices); }, what are the two ...?

  • A The first is rest (collects arguments), the second is spread (expands the array into arguments) Correct
  • B Both are spread
  • C Both are rest
  • D The first is spread, the second is rest
Correct Answer: Option A

In a parameter list ... collects (rest); in a call it expands (spread).

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links