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.
Loading...
Related Quiz
- You are designing a schema for a database that needs to support real-time analytics. What factors would you consider to optimize the read performance of the database?
- You are developing a user management system and need to design routes for CRUD operations. How would you structure the routes to follow RESTful principles in Express.js?
- In JavaScript, a function that is defined inside another function has access to the outer function's variables, forming a ________.
- Which of the following ESLint rules enforces consistent indentation in your code?
- Which method can be used to add new elements to an array in JavaScript?