DEV Community

Discussion on: Keeping Your Code Simple

zeddotes profile image

Maybe I'm missing something, but doesn't passing an initialValue after your reduce's callback mean that what you're calling str1 (in the callback) is actually the accumulator? For the sake of verbosity, I'd name it accordingly. Better yet, I'd get rid of the initialValue altogether.

Please correct me if I'm wrong.