3 ms·
Precisely - this is an API design failure, pure and simple. Not a problem with typing, optional arguments, etc.
by happytoexplain 7y ago
Precisely - this is an API design failure, pure and simple. Not a problem with typing, optional arguments, etc.
- wutbrodo 7y agoIt's both. Silently accepting variadic arguments increases the odds of something like this happening. This case wouldn't have happened without it. Though as I said in another comment, best-effort parsing was a decision that arose out of the Web ecosystem and its one of the few things about Javascript's language design that can't br blamed on incompetence.
- zbentley 7y agoWhat does this have to do with best-effort parsing? "Variadic arguments" (really optional arguments with defaults/signature overloading, which is only arguably the same thing) existed long before JavaScript, and, indeed, the web. Optional arguments are also widely considered to be good/useful.