Any help with the below. The function should take any string with a jumble of letters and numbers. It should add together all the numbers that appear in the string and return the total.
E.g. 'foo5bar6cat1' => 12 'foo98cat' => 17
I have tried the following but no luck.
function sumDigitsFromString (str) {
let arr = str.split('');
arr = arr.reduce(function(a, b) {
return Number('0') + Number('a');
}, 0);
return arr;
}