What is the primary use of the spread operator in JavaScript?

  • To merge arrays and objects
  • To create a new array with the same elements
  • To create a deep copy of an object
  • To remove elements from an array
The primary use of the spread operator (...) in JavaScript is to merge arrays and objects. It can also be used to clone an array or object, effectively creating a new array or object with the same elements or properties.
Add your answer
Loading...

Leave a comment

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