Skip to content

Instantly share code, notes, and snippets.

@benvds
Created January 6, 2017 15:22
Show Gist options
  • Save benvds/736fbdaccfdde69f0f61fa9ceaab8e16 to your computer and use it in GitHub Desktop.
Save benvds/736fbdaccfdde69f0f61fa9ceaab8e16 to your computer and use it in GitHub Desktop.
// rotate an array
const rotate = (amount, list) => {
const offset = -(amount % list.length);
return list.slice(offset).concat(list.slice(0, offset));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment