about | help | code help+videos | done | prefs |
Write a method named switchPairs that accepts an array of strings as a parameter and switches the order of pairs of values in the array. Your method should swap the order of the first two values, then switch the order of the next two, and so on. If there are an odd number of values, the final element is not moved. switchPairs(["a", "bb", "c", "ddd", "ee", "f", "g"]) → ["bb", "a", "ddd", "c", "f", "ee", "g"] switchPairs(["I", "have", "a", "dream"]) → ["have", "I", "dream", "a"] switchPairs([]) → [] ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Copyright Nick Parlante 2017 - privacy