// sum of a string "a" of numbers e.g. 3,2,4,1 = 10 function GetSum(a) { // split the passed string into new array var nums = a.split(','); var total = nums.reduce((subTotal, number) => { return subTotal + number; }, 0); return total; }