Multi-index assignment.

Isiah Meadows isiahmeadows at gmail.com
Tue Dec 5 13:45:26 UTC 2017


You could also use computed indices, too.

```js
Object.assign(array, {
    [index]: foo,
    [index + 1]: bar,
})
```

On Tue, Dec 5, 2017, 06:39 medikoo <medikoo+mozilla.org at medikoo.com> wrote:

> Just do:
>
> ```js
> Object.assign(array, [0, 1]);
> ```
>
> You can also omit some indexes (and they won't be overwritten with
> undefined). e.g. fill just index 3 and 5:
>
> ```js
> Object.assign(array, [,,,3,,5]);
> ```
>
>
>
>
> --
> Sent from:
> http://mozilla.6506.n7.nabble.com/Mozilla-ECMAScript-4-discussion-f89340.html
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20171205/8678d94f/attachment.html>


More information about the es-discuss mailing list