Uninteresting parameters

Sean Eagan seaneagan1 at gmail.com
Mon Sep 26 14:35:31 PDT 2011

Most aspects of destructuring are supported in parameter lists:

* rest parameters
* destructuring of individual parameters

However, there is at least one aspect which is not, which is
uninteresting parameters :

[x, , z] = arr;

which for parameter lists would look like:

function(x, , z) {...}

This could be useful when you are a defining a callback which needs to
match a certain signature, but you only care about a certain subset of
the arguments not at the beginning.  For example:

function evens(arr) {
  arr.filter(function(,index) {return index % 2});

However, I admit it can look strange especially when the uninteresting
parameter is at the beginning as in the above example.

Sean Eagan

More information about the es-discuss mailing list