4 ms·
is `.reduce` the preferred method then?
by culi 5y ago
is `.reduce` the preferred method then?
- zeroonetwothree 5y agoYou could use `reduce` but it's a lot slower than a normal loop. And if your array is tiny (such that perf doesn't matter) you can just do the spread operator, so there's no real reason to ever use it.
- deleted 5y ago[deleted]