On Mon, Dec 4, 2017 at 7:21 PM, /#!/JoePea <[email protected]> wrote:
>
> I always run into situations where I'd like to assign some things from 
> another array.
>
> ...
>
> could be written as
>
> ```js
> array[0, 1] = [1, 2]
> ```

No, it couldn't, because that's already valid syntax for setting
`array[1]` to the new array `[1, 2]`. (Comma operator turns `0, 1`
into `1`.)

You can use destructuring, but it's longer than the individual
assignments would be:

```js
[array[0], array[1]] = [1, 2];
```

-- T.J. Crowder
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to