Aggregate

Aggregate is a general aggregator over a data set that passes pairs of first and immediately next element of the data set to a lambda function and returns the cumulative result of lambda expression.

JavaScript (Reduce)

var totalSize = pencils.reduce((previous, current) => {
    return previous.size + current.size;
});