WARNING

Are you sure you want to reset the challenge? You'll lose all changes you've made to the code.

CHALLENGE: Swap First and Last

Using what you've learned about arrays, write a function swap that takes an array and returns an array that:

  • has as its first element the last element of the input array
  • has as its last element the first element of the input array
  • all the values in between remain the same

Put another way, swap swaps the first and last elements on the input array.