Hacker News new | ask | show | jobs
by admnor 4611 days ago
That "feature" would be better with an explicit language construct such as *args or params args[], though. As with so many complaints about JavaScript, it's the default behaviour that is a problem.
2 comments

I'd say it's worse than a default behavior, since there's no sane way to reverse the default. Are explicit arg list checks really an option, when you want to opt out of the default? I'd say that's not practical at all -- so it's really worse, as there's no practical opt out of this.
ES6 brings "rest parameter" [0].

function(param1, param2, ...rest) {}

[0] http://ariya.ofilabs.com/2013/03/es6-and-rest-parameter.html