You could use reduce for this `http://underscorejs.org/#reduce`