Skip to content

Instantly share code, notes, and snippets.

@jqr
Created November 10, 2009 23:23
Show Gist options
  • Save jqr/231382 to your computer and use it in GitHub Desktop.
Save jqr/231382 to your computer and use it in GitHub Desktop.
var grouped_products = [[]];
var group_index = 0;
_.each(products, function(product, index) {
if (index % 3 == 0) {
group_index++;
grouped_products[group_index] = []
}
grouped_products[group_index].push(product);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment