Your solution for exercise 20 is not really correct. It works for provided functions and inputs, but won't work for situations where, for example, first function appends something to the string. It also assumes that parameters are strings.
Great! I was going to comment the same. it seems much more correct answer. This way you are not limiting to string pipe. Value can be whathever the first function recieves as argument.
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.
Hi,
Your solution for exercise 20 is not really correct. It works for provided functions and inputs, but won't work for situations where, for example, first function appends something to the string. It also assumes that parameters are strings.
Example where it will fail (return
ssss):I believe more complete and actually also simpler solution is to correctly use initial value of reduce, like below:
Cheers!
Great! I was going to comment the same. it seems much more correct answer. This way you are not limiting to string pipe. Value can be whathever the first function recieves as argument.