Dominik Bulaj
Mar 12, 2021

--

How about one-liner solution to count all the values incl. in nested arrays:

ar.flat(Number.MAX_SAFE_INTEGER).reduce((acc,curr)=>acc+curr);

--

--