Re:FP techniques that will help you write better JavaScript
by dragonwriter on Friday February 11, 2022 @02:30PM
(#30305963)
> The index and the collection iterated over is passed as the 2nd/3rd parameters in JavaScript,
Yeah, the “map and friends pass extra parameters that are usually ignored” plus the “lots of JS functions optionally take extra parameters that are usually unused” makes it so easy to think of a function as a one-arg function when its really one plus multiple optionals, use it bare in a map, and get stung by it.
Yeah, the “map and friends pass extra parameters that are usually ignored” plus the “lots of JS functions optionally take extra parameters that are usually unused” makes it so easy to think of a function as a one-arg function when its really one plus multiple optionals, use it bare in a map, and get stung by it.