An experienced software developer with a strong background in developing award-winning web and mobile applications for diverse clients with 6+ years of industry experience.
Are you sure that is how it truly works, what if my accumulator is not a number? do you know you can implement map and filter Array functions using reduce?
I think a better representation will be:
functionreduce(arr,fn,accumulator=0){arr.forEach((item,index)=>{accumulator=fn(accumulator,item,index)// set the current accumulator value to the return value of the function})returnaccumulator}
Are you sure that is how it truly works, what if my accumulator is not a number? do you know you can implement map and filter Array functions using reduce?
I think a better representation will be:
And welcome to Dev.together 🥰🥰🥰
Thank you for this but really I just wanted to let beginners see what the reduce() looks like behind the scene. But truly, thank you. 🤗