import functools
from functools import reduce
def sum_of_digits(number):
return functools.reduce(add, to_list(number))
def add(x, y):
return x + y
def to_list(num):
return list(map(int, str(num)))
let nums = [1, 2, 3];
nums.reduce((curr, next) => curr + next);
arrSum = function(arr){ return arr.reduce(function(a,b){ return a + b }, 0);}