DEV Community

Discussion on: Which Array Function When?

Collapse
 
andrew565 profile image
Andrew Steele

Glad it's been helpful for so many folks already!

Yes, some of these functions could be reduced (pun intended) to an even smaller and possibly more performant size using &&, ternary operators, or ++accumulator instead of accumulator + 1. If you're interested in how to take your code to the next level with some of those refactors, definitely read the other comments here!

I intentionally stayed away from some of those 'intermediate level' code 'tricks' for the sake of making these examples as readable as possible. ;)