AI

.slice() extracts a portion (doesn't modify original), while .splice() modifies the array in place.

Your Task:

  • Use .slice(1, 3) on items to get elements at index 1 and 2 → middle
  • Make a copy of items using spread or slice
  • Use .splice(0, 1) on the copy to remove the first element → withoutFirst
TypeScript Solution
Loading...

Submit your code to see test results