I have a table of data, held as a javascript array which I need multiple levels of subtotals. I know I can use the reduce method of an array to provide a total but cannot ge