Question 8 of 10Pro Only

What are spread and rest operators in JavaScript? How does destructuring work with arrays and objects?

Sample answer preview

## Spread Operator (...) Expands an iterable (array, object) into individual elements. ### Arrays ```javascript const arr1 = [1, 2, 3]; const arr2 = [...arr1, 4, 5]; // [1, 2, 3, 4, 5] // Copying arrays (shallow) const copy = [...arr1]; // Merging arrays const merged = [...arr1,…

spread operatorrest operatordestructuringES6arraysobjects

Unlock the full answer

Get the complete model answer, key points, common pitfalls, and access to 9+ more Full-Stack Developer interview questions.

Upgrade to Pro

Starting at $19/month • Cancel anytime