Summe des positiven JavaScripts
function positiveSum(arr) {
return arr.reduce((acc, curr) => acc + (curr > 0 ? curr : 0))
}
positiveSum([1,2,-3,4]) // 7
Suman Majhi
function positiveSum(arr) {
return arr.reduce((acc, curr) => acc + (curr > 0 ? curr : 0))
}
positiveSum([1,2,-3,4]) // 7