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