Echo JS 0.11.0

<~>
vnk 3680 days ago. link parent 1 point
The point is how they've decided to implement Array#reduce.

If you go up to exercise 16, you'll see they force the result of reducing to always be returned inside an array.

		return [accumulatedValue];

They even remind you in the comment in exercises 17 and 18:

    // Remember that reduce always
    // returns an array with one item.

I can't say I agree with this decision (it's not the common way to do reduce), but following their own version of reduce, then exercise 19 is correct.

Replies