DEV Community

Discussion on: HackerRank Series #1: Simple Array Sum

Collapse
 
afrndofu profile image
abₕᵢₛₕₑₖ

A implementing Higher Order functions reduce function can make it easier
const arr=[1,2,3,4,5]
console.log(arr.reduce((a,b)=>a+b)) // Outputs: 15