Cyril Auburtin (2018-03-25T18:27:09.000Z)
String and Array share a few methods.

I think `repeat` could exist for Array as well

At the moment are other more verbose ways to do so:

- `Array.from({length: n}, () => 'foo')`
- `Array(n).fill('foo')`
- `[].concat(...Array.from({length: 3}, () => ['x', 'y']))`
- `[].concat(...Array(3).fill(['x', 'y']))`

so with repeat it would just be;

- `['foo'].repeat(n)`
- `['x', 'y'].repeat(3)`
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180325/a94baa58/attachment.html>
cyril.auburtin at gmail.com (2018-03-26T19:02:46.623Z)
String and Array share a few methods.

I think `repeat` could exist for Array as well

At the moment, there are other more verbose ways to do so:

- `Array.from({length: n}, () => 'foo')`
- `Array(n).fill('foo')`
- `[].concat(...Array.from({length: 3}, () => ['x', 'y']))`
- `[].concat(...Array(3).fill(['x', 'y']))`

so with repeat it would just be;

- `['foo'].repeat(n)`
- `['x', 'y'].repeat(3)`