DEV Community

loading...

Discussion on: Keeping Your Code Simple

Collapse
zeddotes profile image
zeddotes

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.