Skip to content

Instantly share code, notes, and snippets.

@baniol
Created January 15, 2014 09:33
Show Gist options
  • Save baniol/8433354 to your computer and use it in GitHub Desktop.
Save baniol/8433354 to your computer and use it in GitHub Desktop.
array, slice
var arr = [1,2,3,4,5,6];
var step = 3;
arr.forEach(function (el, i) {
if (i % step === 0) {
var c = arr.slice(i, i+step);
console.log(c)
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment