DEV Community

Discussion on: What’s your alternative solution? Challenge #50

Collapse
 
arsprogramma profile image
ArsProgramma • Edited

Using recursive JavaScript:

const sumArray = (ar) =>  ar.reduce((p, el) => Array.isArray(el) ? p + sumArray(el) : p + el, 0)