Course · Section 9: Data Structures, Modern Operators and Strings · Lecture 111: The Spread Operator (...)
Implement `insertAt(list, index, item)` returning a new array with `item` inserted at `index`.
+ 1 hidden test run on Submit.
slice(0, index) is everything before the insertion point and slice(index) is everything after. Spreading them around the new item produces a fresh array with the item inserted, leaving the original alone.
Run your code to see results.