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. ;)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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 ofaccumulator + 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. ;)