I do agree that reduce isn't that complicated but I was trying to just explain (which I may have done badly) that instead of using reduce its often better to avoid it and using something simpler to understand. For example using .sum is a lot better than using reduce because it's self descriptive in what it does.
That doesn't mean there isn't a usecase for reduce I'd just use it sparingly. But of course that's just my opinion!
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.
Thank you.
And
reduce()
is actually very simple, once you get it. My life has been a lot easier withreduce()
.I do agree that reduce isn't that complicated but I was trying to just explain (which I may have done badly) that instead of using reduce its often better to avoid it and using something simpler to understand. For example using .sum is a lot better than using reduce because it's self descriptive in what it does.
That doesn't mean there isn't a usecase for reduce I'd just use it sparingly. But of course that's just my opinion!