4 ms·
A lot of people are using JavaScript expecting it to conform to the principle of least surprise. Map applies a function f to each element and returns the result
by fgonzag 7y ago
A lot of people are using JavaScript expecting it to conform to the principle of least surprise. Map applies a function f to each element and returns the result. If you want to supply a second argument, you either have to partially apply the function or manually supply the arguments. JavaScript's map is different from what the rest of the world calls map, and that's the problem.
I would never have guessed that it was passing the index as a second parameter, I would have expected a compiler error.