How to sum up only numbers that is merge with alphabets inside an argument in javascript
function getSum(){}
getSum("1ha","22rr","33y",44) => the output will be like this 100
I have tried this but this is not the expected result
function getSum () {
return Array.from(arguments).reduce((sum, value) => {
if (Array.isArray(value)) {
sum += getSum.apply(this, value)
} else {
sum += Number(value)
}
return sum
}, 0)
}
Can someone help me with this please!