You could also use computed indices, too.

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

On Tue, Dec 5, 2017, 06:39 medikoo <[email protected]> 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
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to