Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I am not sure this really has to do with callbacks - isn't this more due to the dangers and hassle of allowing a function with 3 arguments to be called with just one?


It's actually quite the opposite, in this case JS is allowing a function with one argument to be called with two extra argument without complaining. In my view it's ways worse.

Optionals arguments (ideally named and with default values) are quite easily dealt with and the developer is aware he'll break compatibility if he touch them. No error on extra argument is another flavor of madness.


I gathered that it's the danger of allowing a function with 1 parameter to be called with 3 arguments, but I think you're right too.


You can still have a signature mismatch if you're not sending the correct args. The point is to not pass the function to map directly but use the more explicit arrow function.


Absolutely.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: