Reduce should never be used with a non-primitive accumulator imo. We have more semantic alternatives like: • Object.fromEntries() + entries.map() • Object.groupBy() / Map.groupBy() Even for primitives we’ll have Math.sumPrecise() soon ⏳ github.com/tc39/proposa...
github.comGitHub - tc39/proposal-math-sum: TC39 proposal to add a summation method to JavaScriptTC39 proposal to add a summation method to JavaScript - tc39/proposal-math-sum
I love Array.reduce, but I find myself writing less of them as the browser primitives get better. Map + Object groupBy is one place you can now get rid of reduce for www.youtube.com/watch?v=1bfK...
0 reposts10 likes