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.
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.
Maybe I'm missing something, but doesn't passing an
initialValue
after yourreduce
's callback mean that what you're callingstr1
(in the callback) is actually theaccumulator
? For the sake of verbosity, I'd name it accordingly. Better yet, I'd get rid of theinitialValue
altogether.Please correct me if I'm wrong.