I created a function with a regular expression and then iterated over the array by adding the previous total to the next index in the array.
My code isn\'t working. Is m
function sumofArr(str) { var tot = str.replace(/\D/g,'').split(''); return tot.reduce(function(prev, next) { return parseInt(prev, 10) + parseInt(next, 10); });}
sumofArr("12sf0as9d");