Skip to content

Instantly share code, notes, and snippets.

@ethanstenis
Created July 17, 2017 16:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ethanstenis/7a977c46dce4de7aab2476682437fdcb to your computer and use it in GitHub Desktop.
Save ethanstenis/7a977c46dce4de7aab2476682437fdcb to your computer and use it in GitHub Desktop.
This is the solution to Codewars' Kata: My head is at the wrong end.
function fixTheMeerkat(arr) {
var end = arr.shift();
var begin = arr.pop();
arr.push(end);
arr.unshift(begin);
return arr;
}
@caeserlondon
Copy link

or just array.reverse

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment