var subtractProductAndSum = function(n) { array =[]; nString = n.toString(); array = nString.split(","); let sum = array.reduce(function(a,b) { return a + b; }, 0); let product = } return product - sum; }; code example
Example: .reduce mdn
arr.reduce(callback( accumulator, currentValue[, index[, array]] )[, initialValue])