Closed qianist closed 8 months ago
maybe some details is omitted,rewrite it else if (arr=initialValue,arr.length > 0) {
From Appendix A:
With traditional library implementations of reduce(..) (like Ramda), the initial value parameter is in the middle, and not optional.
His library (FPO) makes it optional:
FPO's reduce(..) method can take the arguments in any order, and you can omit the optional initial value if desired.
Quote:
But a standalone implementation of
reduce(..)
might look like this:Question:
Perhaps I don't understand the context, but how to call this function without passing an initialValue?