I am looking for a pattern to get the totals for each n-th item of arrays. Conceptually this would be like getting column totals of a data table.
var dataRows = [ [10, 11, 12, 13], [20, 21, 22, 23], [30, 31, 32, 33] ] // The outcome should be: // [ 60, 63, 66, 69]
[sum(i) for i in zip(*data_rows)]
How would you go about writing this? I am sure the code will be longer without zip, unpack and list comprehension, but can it be done elegantly? Also are there libraries that extend the core library of JS?</div