Trivia: assuming the input to `sum` below is guaranteed to always be a non-trickery array of numbers, so it always returns the same result for the same input, is the function 'pure'?
var x = 0;
function sum(arr) {
x += 1;
return arr.reduce(function(a, b) { return a + b; }, 0);
}