Answers for "sum of positive javascript"

0

sum of positive javascript

function positiveSum(arr) {
  return arr.reduce((acc, curr) => acc + (curr > 0 ? curr : 0))
}

positiveSum([1,2,-3,4]) // 7
Posted by: Guest on April-30-2022

Code answers related to "sum of positive javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language