Course · Section 9: Data Structures, Modern Operators and Strings · Lecture 111: The Spread Operator (...)
Implement `moveItem(list, from, to)` returning a new array with the element at `from` moved to index `to` (useful for drag-and-drop lists).
+ 1 hidden test run on Submit.
Work on a copy made with [...list]. splice(from, 1) removes and returns the moved element; splice(to, 0, moved) inserts it at the destination. Because all of this happens on the copy, the original array is never touched.
Run your code to see results.