about | help | code help+videos | done | prefs |
Given an array containing an even number of elements, return a new array with the two halves of the array swapped. swapHalves([1, 2, 3, 4, 5, 6]) → [4, 5, 6, 1, 2, 3] swapHalves([2, 1, 18, 4]) → [18, 4, 2, 1] swapHalves([4, 9]) → [9, 4] ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 200
Copyright Nick Parlante 2017 - privacy