DEV Community

Discussion on: JavaScript Katas: Split a number array into odd and even numbers

Collapse
 
sqlrob profile image
Robert Myers

Yeah, I would've gone with the reduce too, since that's only one iteration over the array, not two. Not sure I'd use spread though, wouldn't that kill the gain?

Collapse
 
theonlybeardedbeast profile image
TheOnlyBeardedBeast

Probably it would, so just mutate the acc and return it, I think even after all the solutions, I think the simple for loop performs the best.