Javascript Array sum(key)
Array.prototype.sum = function (key) { return this.reduce((memo, item) => memo + (key ? item[key] : item), 0) }