From 4e13857c4d820f8a209c5d405edd14d2b295c01c Mon Sep 17 00:00:00 2001 From: eslopfer Date: Mon, 7 Nov 2022 12:13:55 +0000 Subject: [PATCH] docs(reduce): fix inconsistency in the number of functions --- subjects/reduce/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subjects/reduce/README.md b/subjects/reduce/README.md index 91177a3cb..156c9e594 100644 --- a/subjects/reduce/README.md +++ b/subjects/reduce/README.md @@ -2,7 +2,7 @@ ### Instructions -Create three functions: +Create four functions: - `fold` that receives an array, a function and an accumulator, in this order, and applies the function in the elements of the array starting on the left. @@ -25,6 +25,7 @@ const adder = (a, b) => a + b fold([1, 2, 3], adder, 2) // returns 8 (2 + 1 + 2 + 3) foldRight([1, 2, 3], adder, 2) // returns 8 (2 + 3 + 2 + 1) reduce([1, 2, 3], adder) // returns 6 (1 + 2 + 3) +reduceRight([1, 2, 3], adder) // returns 6 (3 + 2 + 1) ``` The use of `[].reduce` and `[].reduceRight` is forbidden for this exercise.