JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://underscorejs.org/underscore.js"></script>
<div id="contents" />
CoffeeScript
# Define a function that takes:
# obj - an object to iterate over
# consSize - the number of consecutive items to get
# iterator - a function we'll with each subset of items
# context - becomes 'this' when in the iterator function
conser = (obj, consSize, iterator, context) ->
for i in [0..obj.length-consSize]
stop = i + consSize
stop = obj.length if stop > obj.length
slice = obj[i...stop]
iterator.call(context, slice, i, obj)
_.mixin({"eachCons": conser})
a = [1,2,3,4,5,6]
printer = (s) -> $("#contents").append("<p>#{s}</p>")
_.eachCons(a, 3, printer )