Course · Section 9: Data Structures, Modern Operators and Strings · Lecture 111: The Spread Operator (...)
Drag-to-reorder UIs need to move an item to a new position without mutating state. Implement `moveItem(list, from, to)` returning a new array with the element at index `from` moved to index `to`.
+ 1 hidden test run on Submit.
Spreading into a fresh array keeps the original untouched. splice(from, 1) extracts the item, and splice(to, 0, item) re-inserts it at the destination. Returning the copy gives React a new reference.
Run your code to see results.