Skip to content

Instantly share code, notes, and snippets.

@edoardoo
Created January 4, 2017 14:58
Show Gist options
  • Select an option

  • Save edoardoo/61509ed88547b9fa83d1b2d2a1735869 to your computer and use it in GitHub Desktop.

Select an option

Save edoardoo/61509ed88547b9fa83d1b2d2a1735869 to your computer and use it in GitHub Desktop.
Array.prototype.rotate = function(count) {
var tmpArray = this.slice();
count -= this.length * Math.floor(count / this.length);
tmpArray.push.apply(tmpArray, tmpArray.splice(0, count))
return tmpArray
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment