Arguments is only deprecated in strict mode.

```js
F(arg) {
let {par1, par2, ..., parN} = arg;
Object.assign(this, arg);
}
```

This version works in strict mode, but it's less clear what parameters
should be passed. I used `Object.assign` because I assumed that `F` was
called with `new`, providing a valid `this` object. Otherwise, your
original example would either throw in strict mode, or add your parameters
to "global", unless it was called with `Function.prototype.call`.

On Wed, Nov 28, 2018 at 3:36 PM Simo Costa <[email protected]> wrote:

> Ops I saw the now ahahah sorry. But anyway there is a function call and an
> object creation and you are forced to pass arguments using an object (not
> so bad but...another object creation).
> To avoid the function call I would do:
> ```js
> F({par1, par2, ..., parN}) {
> this = {...arguments[0]};
> }
> ```
> Another thing...`arguments` is deprecated, right?
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to