I've passed a single object to a function in order to simulate named
parameters. This requires some destructuring at the top of the called
function.

function f(params) {
  var foo = params.foo;
  var bar = params.bar;
  //...
}
f({foo:1, bar:2});

With destructuring this could be reduced to

function f(params) {
  var {foo, bar} = params;
  //...
}

f({foo:1, bar:2});

Could it be reduced even further to the following syntax?

function f({foo, bar}) {
  //...
}

f({foo:1, bar:2});

Peter
_______________________________________________
Es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to