['10', '10', '10', '10', '10'].map(parseInt)
['10', '10', '10', '10', '10'].map(parseInt)
["10","10","10","10","10"].map(x => parseInt(x))It’s a known good practice in JS to always wrap callbacks with a lambda in this situation. Even if you don’t, usually the type checking will catch it, this bug only works because the second argument is a number to both functions.
Defining functions with new names also make it easy to evolve an API over time without causing breakage.
Looking at, e.g. the Python standard library a large number of functions have arguments that were added after the function was first defined. If Python didn’t have optional/keyword arguments then the number of API calls would be substantially larger.
They do, but potentially falsely.
> Looking at, e.g. the Python standard library a large number of functions have arguments that were added after the function was first defined. If Python didn’t have optional/keyword arguments then the number of API calls would be substantially larger.
The inability of Haskell not to have optional arguments isn't too bad, but all in all, I have to concede that you have a fair point. I personally don't miss optional arguments but I can see how they're beneficial (and I would really like named arguments).
1. Functions can be called with the wrong number of arguments.
2. map() passes multiple arguments to the callback.