Uninteresting parameters
Sean Eagan
seaneagan1 at gmail.com
Tue Sep 27 06:11:37 PDT 2011
On Mon, Sep 26, 2011 at 4:47 PM, Xavier MONTILLET
<xavierm02.net at gmail.com> wrote:
> Normally, you use an object for optional arguments.
This is probably the most common case in practice, however...
> And there is no good reason not to since you don't care about the order of
> the arguments.
There are two good reasons:
* it's more concise since you don't have to prefix each argument
access with the the object argument name + ".", however, destructuring
now helps here
* library author does not need to introduce argument names, the
callback author can use whatever names they want, such as an
abbreviations for example
Also, there are existing and future in-language APIs which receive
multiple argument callbacks, for example:
* Array.prototype methods
* Proxy traps
Thanks,
Sean Eagan
More information about the es-discuss
mailing list