Which of the following is a use case for the rest operator in function parameters?

  • Collecting multiple arguments into an array
  • Spreading an array into multiple arguments
  • Creating a shallow copy of an array
  • Combining two arrays into one
The primary use case for the rest operator in function parameters is to collect multiple arguments into an array. It allows a function to accept a variable number of arguments and access them as an array. The other options are not the intended use of the rest operator in this context.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *