n8n Β· Arrays

n8n reduce()

Reduces an array to a single value, such as a total, by carrying an accumulator through every element.

Syntax

array.reduce((acc, item) => newAcc, initial)

Example

$json.items.reduce((s, i) => s + i.price, 0)

Result: 35

Equivalent in Make.com

sum() β€” sum(array) / sum(value1; value2; ...)

Practice reduce() β€” free interactive labs

More n8n arrays functions