Course · Section 9: Data Structures, Modern Operators and Strings · Lecture 111: The Spread Operator (...)
Implement `headTail(arr)` returning `{ head, tail }` where `head` is the first element and `tail` is an array of the rest, using array destructuring with a rest element.
+ 1 hidden test run on Submit.
Destructuring with a rest element captures the first item and gathers the remainder into a new array.
Run your code to see results.